teranetsrl / oauth2_client

Simple Dart library for interacting with OAuth2 servers.
BSD 2-Clause "Simplified" License
97 stars 114 forks source link

The browser is still present in recent apps even after successful authentication. #156

Open SriramKiranSenthilkumar opened 1 year ago

SriramKiranSenthilkumar commented 1 year ago

hey,

I have implemented the login authentication using the oauth2-client package and facing this issue in my end. Once I install the app and start the login authentication in a browser and after the login authentication is succeeded, it gets redirected to app main page but while checking the recent apps, the external browser which was used for authentication is still available in the recent apps. Not sure why the external browser didn't get close automatically after authentication for success and redirected to app!

andrewpmoore commented 6 months ago

Try adding webAuthOpts: {'preferEphemeral': true}, when setting up the oauth2Helper

e.g.

OAuth2Helper oauth2Helper = OAuth2Helper(oauth2Client,
        grantType: OAuth2Helper.authorizationCode,
        clientId: environment.client,
        webAuthOpts: {'preferEphemeral': true},
        scopes: ["unclaimTask", "task", "calendars", "submitDataCapture", "claimTask", "noteTypes", "viewActivePatientServices", "executeRule", "tasks"]);
binhitmobile commented 2 months ago

If the problem occurs on Android then try the following: Step 1: Open AndroidManifest.xml Step 2: Find tag <activity android:lable=".MainActivity">...</activity> Step 3: Remove field: android:taskAffinity="" Step 4: Run project again Magic!