MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
271 stars 244 forks source link

How to end session without open external browser ? #279

Closed postflow closed 2 years ago

postflow commented 2 years ago

My method for logout:

endIdentitySession() async {
    await appAuth.endSession(EndSessionRequest(
         idTokenHint: idToken,
         postLogoutRedirectUrl: AUTH0_REDIRECT_URI,

        serviceConfiguration: AuthorizationServiceConfiguration(
            authorizationEndpoint: 'https://$AUTH0_DOMAIN/connect/authorize',
            endSessionEndpoint: 'https://$AUTH0_DOMAIN/connect/endsession',
            tokenEndpoint: 'https://$AUTH0_DOMAIN/connect/token')
    ));
  }

but when i call this method, opening browser (chrome custom tabs). How to silent (without open external browser) logout user ?

MaikuB commented 2 years ago

It isn't possible and opening the browser is the expected behaviour as this is what allows the user to be signed out from the browser, which is a similar to how signing in works.

Sidenote: I noticed your code mentions Auth0. From what I've seen, they don't follow the same standard in providing an end session endpoint

Dohmanlechx commented 5 months ago

@MaikuB Are you sure this is not possible and expected behavior? I've never seen this kind of behavior anywhere. In Android, this works as expected and seamlessly (no opt-in popup).

Additionally, this undesired popup in iOS also uses the wrong copy (note it's a sign out action):

[name] Wants to Use [app] to Sign In

Dohmanlechx commented 5 months ago

Sorry, I just found this: https://github.com/MaikuB/flutter_appauth/issues/353

Added preferEphemeralSession: true to the EndSessionRequest object and I no longer get this popup. The web browser is still visible, but it is fine enough. I understand now what you meant by expected behavior.