[SOLVED]Updating recovery returns exception while still updating the user's password in the backend
- 0
- Flutter
Oh i see , i might have confused you on the flow of things. first the PasswordResetRoute
which is the top level component gets the query parameters from the url and pass those along to the PasswordResetPage
which is another component whose main job is to apply responsive /adaptive design based on the current platform and layout. this widget passes then the userId and the secret to PasswordResetScreen
which contains the form for the user to input his new password and confirmation of the new password. On submit those 4 are passed to the controller which then passes them to the usecase which calls the repository with those 4. this is the code you've read above.
@D5 yes i made a print of those 4 at each level and they are correctly extracted
First you need to trigger account.passwordreset
And then updaterecovery
@D5 yes indeed and i do that on my PasswordForgottenRoute
. it follows the same process i explained above and triggers this @override
FutureEither<Token> passwordForgotten({
required String email,
required String url,
}) async {
try {
final token = await _accountService.createRecovery(
email: email,
url: url,
);
return Right(token);
} on AppwriteException catch (e, stackTrace) {
print(e);
return Left(Failure(e.message ?? "error", e, stackTrace));
} catch (e, stackTrace) {
return Left(Failure("error", e, stackTrace));
}
}
and when i receive the email and i click on it i get redirected to my app at my PasswordResetRoute
and the rest is as you already know.
do you know what endpoint throws this error?
@Steven, yeah it is this one final token = await _accountService.updateRecovery(
userId: userId,
secret: secret,
password: password,
passwordAgain: confirmPassword,
);
since the app is opened in chrome and the error seems pretty similar to the one we dealt with last time, i tried deleting the cache but it didnt work
@Steven it updates the password fine though
what version of appwrite?
@Steven 1.3.8
i wonder if it's throwing an exception from one of these: https://github.com/appwrite/appwrite/blob/e26062ca87c0fd97e47a910d22c6bbbee887b74f/app/controllers/api/account.php#L2194-L2200...it would be helpful if you could grab some sort of stacktrace. i think if you have the _APP_ENV variable set to developoment, it might show a stack trace
@Steven ill see how i can get a stacktrace ...yes my _APP_ENV is set to development
the api call should return it then 🧐
@Steven i thought i had to look in the containers log from appwrite side... Ok let me retry and ill post the stacktrace from my chrome console
@Steven i really dont know what causes this issue...here are the screenshots the stacktrace is in the txt file...i modified it with some values for the data i think is sensitive
You're getting an error calling account.get() which is expected since the user doesn't have a session
Switch to the network tab instead of the console tab
@Steven ok
@Steven i now see where i messed up...the recovery itself is fine...i might do something like password reset and log in right away
indeed that is it ....
Or not call account.get() after?
@Steven yes I thought it would be good to log in the user just after and not go to the login screen for that ...I removed the call to account.get() but I have no way in my code of getting the user's email so I'll just let him go to the login screen and go from there
[SOLVED]Updating recovery returns exception while still updating the user's password in the backend
you can log the user in with account.createEmailSession()
and then call account.get()
@Steven thanks I did as you suggested
Recommended threads
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...