Skip to content
Back

Google OAuth2 on Windows with Flutter

  • 0
  • Flutter
  • Auth
Sheila
30 Nov, 2024, 18:21

I am trying to implement Google login in my Flutter application for Windows and macOS. It works correctly on macOS, but on Windows, I encounter the following error:

AppwriteException: Invalid OAuth2 Response. Key and Secret not available (500)

Here is my Flutter code:

TypeScript
   await AppController.account.createOAuth2Session(
     provider: OAuthProvider.google,
     success: (Platform.isMacOS) ? null : 'http://localhost:3000/auth/oauth2/success',
     failure: (Platform.isMacOS) ? null : 'http://localhost:3000/auth/oauth2/failure'
   );
} catch (error) {
  throw CustomException(mensaje: "UNKNOWN_ERROR".tr, showAlert: true);
}```

How can I solve this? Where is the error?
TL;DR
The developer is facing an issue with Google OAuth2 on Windows in their Flutter app, getting an 'Invalid OAuth2 Response' error. The issue might be with the specified URL for success and failure callbacks in the OAuth2 session creation method. By checking the URLs and ensuring they are correct, the problem can be resolved.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more