flutter_web_auth
flutter_web_auth copied to clipboard
No redirection once logged in with Google
Hello, I am trying to follow the sample given in the doc to use Oauth2 in Android with Google as provider. I am well redirected to Google authentication page. But once I log in, I have no redirection at all (neither to the app nor in the browser). Also, I tried to open Chrome and access the redirect_uri manually but it responds the DNS_PROBE_FINISHED_NXDOMAIN error.
Relevant code:
final googleClientId = 'XXXXXXX-xxxxxxxxxxxx.apps.googleusercontent.com';
final callbackUrlScheme = 'com.googleusercontent.apps.XXXXXXX-xxxxxxxxxxxx';
final url = Uri.https('accounts.google.com', '/o/oauth2/v2/auth', {
'response_type': 'code',
'client_id': googleClientId,
'redirect_uri': '$callbackUrlScheme:/',
'scope': 'email',
});
final result = await FlutterWebAuth.authenticate(url: url.toString(), callbackUrlScheme: callbackUrlScheme);
Relevant activity:
<activity android:name="com.linusu.flutter_web_auth.CallbackActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.googleusercontent.apps.XXXXXXX-xxxxxxxxxxxx"/>
</intent-filter>
</activity>
Am I missing something? Or does that mean I misconfigured my app on Google side? Any help would be appreciated!
@Rhesos from what I can tell that should work, and I've been using that approach in one of my apps. Are you sure that you rebuilt the native part of your application after adding the new <activity?
same issue with me
same issue with me. no helpful documentation
I have the same issue on Android - on iOS everything works as expected. I tried downgrading to 0.3.2 and 0.3.2 without success. Since this was working before, I doubt this is a setup problem.
I have the problem on real devices as well as on the emulator
- emulator: Platform android RSR1.201013.001, Google/sdk_gphone_x86 (generic_x86_arm), Android 11 with API level 30
- device: Platform android SQ1D.220205.003, Xiaomi/Redmi Note 5 Pro (whyred), Android 12 with API level 31
- device: Platform android RKQ1.201112.002, Xiaomi/M2101K9G (renoir), Android 11 with API level 30
After confirming my login with my provider (Microsoft or Google), the following exception is raised:
2022-02-16 07:42:54.463 1130-4475/? W/AsyncOperation: operation=GetLaunchDataOperation, opStatusCode=19500 [CONTEXT service_id=121 ]
OperationException[Status{statusCode=Not an instant app, resolution=null}]
at aimm.f(:com.google.android.gms@[email protected] (150700-414534850):18)
at aeiv.run(:com.google.android.gms@[email protected] (150700-414534850):11)
at byvi.run(:com.google.android.gms@[email protected] (150700-414534850):2)
at voc.c(:com.google.android.gms@[email protected] (150700-414534850):6)
at voc.run(:com.google.android.gms@[email protected] (150700-414534850):7)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at vub.run(:com.google.android.gms@[email protected] (150700-414534850):0)
at java.lang.Thread.run(Thread.java:923)
2022-02-16 07:42:54.468 5238-5238/? E/cr_InstantAppsHandlerI: Exception when calling getInstantAppLaunchData
bs: 19500: Not an instant app
at Ju.a(chromium-TrichromeChromeGoogle.aab-stable-410410681:3)
at yv.a(chromium-TrichromeChromeGoogle.aab-stable-410410681:6)
at com.google.android.gms.common.api.internal.BasePendingResult.k(chromium-TrichromeChromeGoogle.aab-stable-410410681:16)
at com.google.android.gms.common.api.internal.BasePendingResult.j(chromium-TrichromeChromeGoogle.aab-stable-410410681:5)
at sA.a1(chromium-TrichromeChromeGoogle.aab-stable-410410681:28)
at oC.onTransact(chromium-TrichromeChromeGoogle.aab-stable-410410681:3)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
So I assume that custom chrome tabs have changed in an unexpected way.
Hope this information helps!
The solution is to set android:exported="true" in the AndroidManifest.xml for the CallbackActivity.
I still get the error, but it does not seem to matter much:
2022-02-16 15:56:59.493 1130-1130/? D/BoundBrokerSvc: onBind: Intent { act=com.google.android.gms.instantapps.START pkg=com.google.android.gms }
2022-02-16 15:56:59.493 1130-1130/? D/BoundBrokerSvc: Loading bound service for intent: Intent { act=com.google.android.gms.instantapps.START pkg=com.google.android.gms }
2022-02-16 15:56:59.530 1130-4475/? W/AsyncOperation: operation=GetLaunchDataOperation, opStatusCode=19500 [CONTEXT service_id=121 ]
OperationException[Status{statusCode=Not an instant app, resolution=null}]
at aimm.f(:com.google.android.gms@[email protected] (150700-414534850):18)
at aeiv.run(:com.google.android.gms@[email protected] (150700-414534850):11)
at byvi.run(:com.google.android.gms@[email protected] (150700-414534850):2)
at voc.c(:com.google.android.gms@[email protected] (150700-414534850):6)
at voc.run(:com.google.android.gms@[email protected] (150700-414534850):7)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at vub.run(:com.google.android.gms@[email protected] (150700-414534850):0)
at java.lang.Thread.run(Thread.java:923)
2022-02-16 15:56:59.545 19549-19549/? E/cr_InstantAppsHandlerI: Exception when calling getInstantAppLaunchData
bs: 19500: Not an instant app
at Ju.a(chromium-TrichromeChromeGoogle.aab-stable-410410681:3)
at yv.a(chromium-TrichromeChromeGoogle.aab-stable-410410681:6)
at com.google.android.gms.common.api.internal.BasePendingResult.k(chromium-TrichromeChromeGoogle.aab-stable-410410681:16)
at com.google.android.gms.common.api.internal.BasePendingResult.j(chromium-TrichromeChromeGoogle.aab-stable-410410681:5)
at sA.a1(chromium-TrichromeChromeGoogle.aab-stable-410410681:28)
at oC.onTransact(chromium-TrichromeChromeGoogle.aab-stable-410410681:3)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
same problem here only happens with Google
same is the case with mine.Was able to get call back in iOS but in android no call back is received.Anyone has got solution to this?
The solution is to set android:exported="true" in the AndroidManifest.xml for the CallbackActivity.
This has been added to our troubleshooting guide: https://github.com/LinusU/flutter_web_auth#troubleshooting
Please follow that if you are still having problems!