flutter_appauth icon indicating copy to clipboard operation
flutter_appauth copied to clipboard

Redirect is not working on Android

Open sylvestrevgen opened this issue 3 years ago • 10 comments

I follow readme instruction for both platforms iOS and Android. In iOS everything is fine, but in Android redirect is not working. I set auth scheme in build.gradle and set queries element in AndroidManifest. Redirect URI is correct, cause in iOS working.

sylvestrevgen avatar Jan 10 '22 14:01 sylvestrevgen

<img width="377" alt="Screenshot 2022-01-10 at 17 08 27" src="https://user-images.githubusercontent.com/32303723/1487888 Screenshot 2022-01-10 at 17 08 18 02-e57b95e3-ac62-4f78-b9fd-c9dd69ac945c.png"> Screenshot 2022-01-10 at 17 08 04

sylvestrevgen avatar Jan 10 '22 15:01 sylvestrevgen

Screenshot 2022-01-10 at 17 08 27

sylvestrevgen avatar Jan 10 '22 15:01 sylvestrevgen

In Android after successful login it is white screen in browser and redirect is not working

sylvestrevgen avatar Jan 10 '22 15:01 sylvestrevgen

If you've configured everything properly on your end when it comes to this plugin then I would suggest you check seeing if keycloak requires anything specific for Android that requires more setup outside of this plugin. I vaguely remember seeing others mentioning this but I've no experience with keycloak. I would suggest you ask on places like stack overflow, discord etc to see if anyone else has run into similar issues given the plugin works with other IdPs

MaikuB avatar Jan 18 '22 07:01 MaikuB

Hi, @sylvestrevgen I had the same issue. a)I migrate the project embedding v2. b) in AndroidManifest.xml you should find <application android:label="auth0" android:name="${applicationName}" android:icon="@mipmap/ic_launcher"> <activity and remove android:name="${applicationName}

upruslanko avatar Jan 21 '22 12:01 upruslanko

In Android after successful login it is white screen in browser and redirect is not working

@sylvestrevgen Did you figure this out? I am having the same issue. @upruslanko What do you mean exactly, what did you delete from AndroidManifest.xml ?

everystone avatar Feb 21 '22 13:02 everystone

If anyone hits this issue (white screen), its likely your appAuthRedirectScheme that is wrong, and is causing the app to not respond to the redirect uri. My redirect uri was originally just a https url, after changing it to the format com.yourdomain:/auth, as described here and changing the appAuthRedirectScheme to com.yourdomain it worked.

everystone avatar Feb 22 '22 11:02 everystone

I have the same issue. any solution ??

emamagic avatar Mar 02 '22 12:03 emamagic

If anyone hits this issue (white screen), its likely your appAuthRedirectScheme that is wrong, and is causing the app to not respond to the redirect uri. My redirect uri was originally just a https url, after changing it to the format com.yourdomain:/auth, as described here and changing the appAuthRedirectScheme to com.yourdomain it worked.

thanks, it worked for me

emamagic avatar Mar 02 '22 15:03 emamagic

I have the same issue. Can anyone find the solution @MaikuB @emamagic @everystone

in Android Manifest : image

Method : AuthorizationTokenResponse? authorizationTokenResponse = await appAuth!.authorizeAndExchangeCode( AuthorizationTokenRequest( getAppConfig().apiUrlResource.fusionAuthClientId, getAppConfig().apiUrlResource.fusionAuthRedirectUrl, issuer: 'https://${getAppConfig().apiUrlResource.fusionAuthDomain}', scopes: <String>['offline_access'], ), );

REDIRECT URL : com.example.kipling://login-callback

in App Build Gradle :

image

rajatjain7869 avatar Apr 15 '22 07:04 rajatjain7869

Closing this as the issue is configuration-related and there's been no evidence to indicate it's an issue with the plugin or the SDKs the plugin uses

MaikuB avatar Oct 08 '22 05:10 MaikuB

After many hours of debugging, it seems the appAuthRedirectScheme must not contain underscores.

This is valid: 'appAuthRedirectScheme': 'some.name.here.no.underscore'

This is invalid 'appAuthRedirectScheme': 'some.name.here.with.underscore_'

@MaikuB would be great if you could add this to the documentation

adrianvintu avatar Mar 29 '23 12:03 adrianvintu