flutter_web_auth_2
flutter_web_auth_2 copied to clipboard
Redirection to app does not work
Description
Redirection to app does not work. I am using Google sign in authentication process and after successfully sign in it redirects to callback url and opens it. But I don't need it. I need to close browser after successfull sign in process. This is redirect url https://zygomorphic-carola-td-money.koyeb.app/callback. Despite the fact I added all necessery fields in Android Manifest it does not redirect to app. What is wrong in my implementation ? Maybe I miss something ?
Minimal Reproduction
Steps to reproduce the behaviour:
- Use the following code:
action: () async { final String result = await FlutterWebAuth2.authenticate( url: "https://zygomorphic-carola-td-money.koyeb.app/v1/client/auth", callbackUrlScheme: "https", ); print('result is $result'); final token = Uri.parse(result).queryParameters['state']; print('token is $token'); },
- Android Manifest activity
<activity
android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="zygomorphic-carola-td-money.koyeb.app"
android:pathPrefix="/callback"
/>
</intent-filter>
</activity>
Exception or Error
There is not error, just redirection does not work properly.
Expected Behaviour
After receiving redirected url, browser has to close and should return to app.
Screenshots
No response
Additional context
No response
Device
Xiaomi Redmi Note 9
OS
Android
Browser
Chrome
Flutter version
3.13.8
flutter_web_auth_2 version
3.1.1
Checklist
- [X] I have read and followed the entire troubleshooting guide and it has not provided the solution I need.
- [X] I have provided all the information I can.
There was already a similar issue at some point: #56 Sadly, this seems to be related to some issues within Android and I would always advise to use a custom scheme instead of http/https as it seems to be the only solution currently.
@ElvinMammadov something worked for you?
I guess this is still broken on Android? Thanks for everyones hard work creating the package.
@Painwraith The troubleshooting guide has been expanded since last time, also due to #113 - maybe the solutions from there helps?