And how could I do it because if eh replaced the correct id and key of Google cosola and I realize that in appwrite if you register but the app does not log in I think I have an error in my code I am in flutter.
Sorry I don't quite understand you
I mean that appwrite if the user is saved, but in the app it does not receive the credentials
do you mean you're not redirected back into the app?
If it redirects me but does not validate the credentials, an error appears when starting with Google.
sprry i don't understand
maybe you can share a recording of what's going wrong?
what's your updated code including _updateAuthStatus()
? Please make sure to format the code using 3 back ticks.
please also share your logs because the screen recording doesn't show the output of
if (e is AppwriteException) {
print('Error al iniciar sesión con OAuth:');
print('Mensaje: ${e.message}');
print('Código: ${e.code}');
print('Tipo: ${e.type}');
} else {
print('Excepción no reconocida:');
print(e);
}
I/flutter ( 9414): Error al iniciar sesión con OAuth: I/flutter ( 9414): Mensaje: Invalid OAuth2 Response. Key and Secret not available. I/flutter ( 9414): Código: 500 I/flutter ( 9414): Tipo: null I/flutter ( 9414): Inicio de sesión con Google fallido
What is the code in _updateAuthStatus()
?
Stream<bool> isAuthenticated() { _updateAuthStatus(); return _authController.stream; }
void _updateAuthStatus() async { bool isAuthenticated = await _checkAuthenticated(); _authController.add(isAuthenticated); }
Okay and what's inside _checkAuthenticated()
With email and password the login works correctly, but with Google I don't want appwrite if the name, email and verification are registered normally but it doesn't log in.
Future<bool> _checkAuthenticated() async { try { await account.get(); return true; } catch (e) { print(e); return false; } }
Did you remove the success
and failure
fields?
Enough already and apparently if you log in but the black screen stays, I close it and turn it on, it opens and validates that if you log in, it takes me home. But I don't know how to fix the black screen
Future<bool> loginWithOAuth(String provider) async { try { final session = await account.createOAuth2Session(provider: provider); _updateAuthStatus(); return true; } catch (e) { if (e is AppwriteException) { print('Error al iniciar sesión con OAuth:'); print('Mensaje: ${e.message}'); print('Código: ${e.code}'); print('Tipo: ${e.type}'); } else { print('Excepción no reconocida:'); print(e); } return false; } }
looks like your oauth2 failed for some reason...
Please make sure to use 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.
on your computer, browse to https://cloud.appwrite.io/v1/account/sessions/oauth2/google?project=<your project id>
and try to log in
already solved. I have another question, is it possible to use the login with google natively or only through the web?
Only through web
[SOLVED] Auth flutter
Recommended threads
- Current User is Not authorized
recreating same Thread
- 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...