Rank 1: Thread
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.
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 1: Thread
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
Rank 1: Thread
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?
Rank 1: Thread
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?
Rank 1: Thread
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); }Rank 1: Thread
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()?
Rank 1: Thread
Stream isAuthenticated() {
_updateAuthStatus();
return _authController.stream;
}
void _updateAuthStatus() async {
bool isAuthenticated = await _checkAuthenticated();
_authController.add(isAuthenticated);
}
Okay and what's inside _checkAuthenticated()
Rank 1: Thread
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.
Rank 1: Thread
Future _checkAuthenticated() async {
try {
await account.get();
return true;
} catch (e) {
print(e);
return false;
}
}
Did you remove the success and failure fields?
Rank 1: Thread
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
Rank 1: Thread
Future 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
Rank 1: Thread
already solved. I have another question, is it possible to use the login with google natively or only through the web?
Moderator
Only through web
Moderator
[SOLVED] Auth flutter