MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
274 stars 246 forks source link

sign in doesn't give me the option to select another account (even with preferEphemeralSession=true) #500

Open dprophete opened 5 months ago

dprophete commented 5 months ago

problem

Trying to integrate a microsoft sign in with my app. I am always stuck in a pre-existing account with no way to select another account (even in ephemeral session mode)

details

Everything works fine if I never signed in with the browser. I get the popup which asks for my username/password. Perfect.

image

Unfortunately If I ever signed in with the browser in the past, I now get this popup:

image

And there is no way way to say "no, I want to sign in to a different org, or use a different account". Nothing. Cancel just closes the window.

The only solution I found is to ask my users to switch to chrome and clear the browser data, but obviously this is not going to happen. Am I missing something obvious ?

code

This is what I am using to bring up the auth page:

    final AuthorizationTokenResponse? result = await appAuth.authorizeAndExchangeCode(
      AuthorizationTokenRequest(
        _clientId,
        _redirectUrl,
        serviceConfiguration: AuthorizationServiceConfiguration(
            authorizationEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
            tokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
            endSessionEndpoint: '<end_session_endpoint>'),
        scopes: ['openid', 'profile', 'email', 'offline_access'],
        preferEphemeralSession: true,
      ),
    );

(ps: I thought preferEphemeralSession: true was to explicitly address this but apparently not...)

hankli97 commented 2 months ago

metoo