Search code examples
azureoauthoauth-2.0azure-active-directory

Microsoft oauth account selection defaults to last used account even when multiple accounts are available


I'm using Microsoft OAuth2 to get access token for my app. The normal Oauth flow works fine but if I have multiple accounts it always defaults to the last used account without letting me choose an account even if it's available in the list.

The only alternative I can think of is to use prompt=login but thats too intrusive, especially for every login.

My oauth urls

Auth request: https://login.microsoftonline.com/common/oauth2/authorize?client_id=<myAppId>&response_type=code&redirect_uri=<myUrl>&scope=User.Read&state=1111

Token request: https://login.microsoftonline.com/common/oauth2/token?client_id=<myAppId>&client_secret=<myAppSecret>&redirect_uri=<myUrl>&code=<codeFromPreviousCall>&grant_type=authorization_code

Is there a param that can be set to make user select an account?

Please see the gif below and note that I'm not clicking on any account in the second page Microsoft Account selection


Solution

  • You can use prompt=select_account.

    select_account: The user is prompted to select an account, interrupting single sign on. The user may select an existing signed-in account, enter their credentials for a remembered account, or choose to use a different account altogether.