Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No redirection once logged in with Google #69

Closed
Rhesos opened this issue Apr 27, 2021 · 8 comments
Closed

No redirection once logged in with Google #69

Rhesos opened this issue Apr 27, 2021 · 8 comments

Comments

@Rhesos
Copy link

Rhesos commented Apr 27, 2021

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!

@LinusU
Copy link
Owner

LinusU commented Sep 7, 2021

@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?

@ShadmanAfzal
Copy link

same issue with me

@andres-alba
Copy link

same issue with me. no helpful documentation

@robert-virkus
Copy link

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@214815040@21.48.15 (150700-414534850):18)
        at aeiv.run(:com.google.android.gms@214815040@21.48.15 (150700-414534850):11)
        at byvi.run(:com.google.android.gms@214815040@21.48.15 (150700-414534850):2)
        at voc.c(:com.google.android.gms@214815040@21.48.15 (150700-414534850):6)
        at voc.run(:com.google.android.gms@214815040@21.48.15 (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@214815040@21.48.15 (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!

@robert-virkus
Copy link

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@214815040@21.48.15 (150700-414534850):18)
        at aeiv.run(:com.google.android.gms@214815040@21.48.15 (150700-414534850):11)
        at byvi.run(:com.google.android.gms@214815040@21.48.15 (150700-414534850):2)
        at voc.c(:com.google.android.gms@214815040@21.48.15 (150700-414534850):6)
        at voc.run(:com.google.android.gms@214815040@21.48.15 (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@214815040@21.48.15 (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)

@xalikoutis
Copy link

same problem here only happens with Google

@shashank89-sys
Copy link

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?

@LinusU
Copy link
Owner

LinusU commented Nov 1, 2022

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!

@LinusU LinusU closed this as completed Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants