MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
270 stars 243 forks source link

Redirect is not working on Android #284

Closed sylvestrevgen closed 1 year ago

sylvestrevgen commented 2 years ago

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 commented 2 years ago

<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 commented 2 years ago
Screenshot 2022-01-10 at 17 08 27
sylvestrevgen commented 2 years ago

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

MaikuB commented 2 years ago

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

upruslanko commented 2 years ago

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}

everystone commented 2 years ago

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 commented 2 years ago

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.

emamagic commented 2 years ago

I have the same issue. any solution ??

emamagic commented 2 years ago

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

rajatjain7869 commented 2 years ago

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

MaikuB commented 1 year ago

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

adrianvintu commented 1 year ago

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