I'm developing a mobile application in Flutter/Dart and I'm currently working on identity management, specifically the login functionality. I'm using a library called flutter_appauth which is a wrapper for the AppAuth library. I'm having a strange issue that only happens on Android where after a user successfully logs in, no redirection occurs. If the user re-opens the login page after a successful login occurs, they're greeted by a blank screen in the WebView (presumably because the browser keeps the user logged in). The authentication flow for my application goes: App -> Login page -> Identity provider for 2FA -> App. This is what occurs on iOS yet does not redirect back from the ID provider on Android. The application stays on the completed authentication page. The identity provider I'm using is PingID.
This library handles redirection by allowing you to simply define the redirect scheme, which is just the prefix part of the redirect URI. I correctly defined the Redirection scheme in the app/build.gradle file as well as the redirection URI as the following:
Redirect URI: AppName:/callback
defaultConfig {
applicationId "io.example.AppName"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
'appAuthRedirectScheme': 'AppName'
]
}
I made an issue post on the plugin's GitHub which you can take a look at here. The author of the plugin states that if the scheme name and redirect URI are the same, then my issue lies elsewhere. Because my code works on iOS, and I used the same name for the redirect scheme for both platforms, I would imagine my issue isn't me incorrectly defining the redirection scheme. Everything works perfectly on an iOS emulator. I've tested it on 4 different Android devices and 4 different API versions and I have the same issue on all of them. I also tried defining an intent for RedirectUriReceiverActivity and my issue still persists.
I'm new to Flutter, Mobile Dev, and IdM so I would appreciate some guidance. Is there a difference between Chrome and Safari, or iOS and Android that could potentially be blocking this redirection from occurring? I've been searching the internet for a solution for the past 4 days and I have yet to find one so I'm pretty much all out of leads. Any advice?
EDIT: I finally got it working! Hopefully this will help out anyone in the future with this problem. It turns out all I had to do was set the scheme name for appAuthRedirectScheme to an entirely lower case string. So even though my Redirect URI is AppName:/callback, I had to set appAuthRedirectScheme to appname instead of AppName. This got it working.