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

Redirection to app does not work #101

Open
2 tasks done
ElvinMammadov opened this issue Mar 30, 2024 · 2 comments
Open
2 tasks done

Redirection to app does not work #101

ElvinMammadov opened this issue Mar 30, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ElvinMammadov
Copy link

ElvinMammadov commented Mar 30, 2024

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:

  1. 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');
                      },
  2. 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

  • I have read and followed the entire troubleshooting guide and it has not provided the solution I need.
  • I have provided all the information I can.
@ElvinMammadov ElvinMammadov added the bug Something isn't working label Mar 30, 2024
@ThexXTURBOXx
Copy link
Owner

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.

@goj1
Copy link

goj1 commented May 9, 2024

@ElvinMammadov something worked for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants