teranetsrl / oauth2_client

Simple Dart library for interacting with OAuth2 servers.
BSD 2-Clause "Simplified" License
92 stars 114 forks source link

Google Oauth2 - PlatformException(CANCELED, User canceled login, null, null) #50

Open scadot opened 3 years ago

scadot commented 3 years ago

Hi,

I'm using your library to retrieve a google oauth2 token with Authorization Code flow. The process is ok on IOS but each time I call the API on Android, i get the following error: PlatformException(CANCELED, User canceled login, null, null)

On the GCP, I create a OAuth 2.0 Client IDs for Android and get the following package name: package_name

In my AndroidManifest.xml, I create a new Intent: intent

And I create the Google client API as below: googleoauth

I'm not sure to understand what I'm doing wrong. Could you please help me to solve this problem?

Thanks.

okrad commented 3 years ago

Hi @scadot, can you try adding an additional "/" in the redirectUri (com.example.remote://oauth2redirect)?

supermar1010 commented 2 years ago

I had the same problem for me it was fixed, by adding the activity tag for com.linusu.flutter_web_auth.CallbackActivity. And then uninstalling flutter clean and then reinstalling the app :)

alexandranb commented 2 years ago

Hi, if I add com.linusu.flutter_web_auth.CallbackActivity to my app, the app crashes after install. Did anyone have this issue with it?

supermar1010 commented 2 years ago

Without a stacktrace it is hard to say what went wrong. Did you completely reinstall the app after adding the lib and the Manifest entry?

alexandranb commented 2 years ago

Yes, added com.linusu.flutter_web_auth.CallbackActivity to manifest. Cleaned app, built it, uninstalled it, and ran it. After installment it briefly displayed the splashscreen and then it automatically closed. Nothing appears in debug. Flutter version 2.5.3