Skip to content

[Bug] WAM Error - Account has previously been signed out of this application. #4977

@markjercoates

Description

@markjercoates

Library version used

n/a

.NET version

Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.11.5

Scenario

PublicClient

Is this a new or an existing app?

None

Issue description and reproduction steps

Using: Microsoft Visual Studio Community 2022 (64-bit) - Current - Version 17.11.5
Cannot sign into Visual Studio getting the following error:
WAM Error
Error Code: 0
Error Message: Account has previously been signed out of this application.
Internal Error Code: 540940121

Relevant code snippets

** LogFile**

0/24/2024 08:07:28 GMT Standard Time : Error : There was a problem executing interactive flow error: 'MSAL.NetCore.4.61.3.0.MsalUiRequiredException:
	ErrorCode: failed_to_acquire_token_silently_from_broker
Microsoft.Identity.Client.MsalUiRequiredException: WAM Error  
 Error Code: 0 
 Error Message: Account has previously been signed out of this application. 
 Internal Error Code: 540940121 

   at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<<RunAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.ApiConfig.Executors.ClientApplicationBaseExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenSilentParameters silentParameters, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.MsalNetworkServicesImpl.ExecuteInteractiveFlowAsync(IGetTokenInteractiveContext getTokenContext, AuthenticationFlowType authenticationFlowType, CancellationToken cancellationToken)
	StatusCode: 0 
	ResponseBody:  
	Headers: '
10/24/2024 08:07:28 GMT Standard Time : Error : There was a problem getting the access token using the prompt with UI flow. Error: 'MSAL.NetCore.4.61.3.0.MsalUiRequiredException:
	ErrorCode: failed_to_acquire_token_silently_from_broker
Microsoft.Identity.Client.MsalUiRequiredException: WAM Error  
 Error Code: 0 
 Error Message: Account has previously been signed out of this application. 
 Internal Error Code: 540940121 

   at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<<RunAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.ApiConfig.Executors.ClientApplicationBaseExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenSilentParameters silentParameters, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.MsalNetworkServicesImpl.ExecuteInteractiveFlowAsync(IGetTokenInteractiveContext getTokenContext, AuthenticationFlowType authenticationFlowType, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.MsalNetworkServicesImpl.ExecuteInteractiveFlowAsync(IGetTokenInteractiveContext getTokenContext, AuthenticationFlowType authenticationFlowType, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderNetworkServicesBase.AcquireTokenWithPromptInternalAsync(String resource, String tenant, UserIdentifier userId, String queryParameters, AuthenticationFlowType authenticationFlowType, Dictionary`2 additionalAuthProperties, CancellationToken cancellationToken)
	StatusCode: 0 
	ResponseBody:  
	Headers: '
10/24/2024 08:07:28 GMT Standard Time : Error : CreateAccount: Creating an account. QueryParameters 'site_id=501454&display=popup&nux=1'
Account creation failed. 
Error: 'MSAL.NetCore.4.61.3.0.MsalUiRequiredException:
	ErrorCode: failed_to_acquire_token_silently_from_broker
Microsoft.Identity.Client.MsalUiRequiredException: WAM Error  
 Error Code: 0 
 Error Message: Account has previously been signed out of this application. 
 Internal Error Code: 540940121 

   at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<<RunAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.ApiConfig.Executors.ClientApplicationBaseExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenSilentParameters silentParameters, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.MsalNetworkServicesImpl.ExecuteInteractiveFlowAsync(IGetTokenInteractiveContext getTokenContext, AuthenticationFlowType authenticationFlowType, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.MsalNetworkServicesImpl.ExecuteInteractiveFlowAsync(IGetTokenInteractiveContext getTokenContext, AuthenticationFlowType authenticationFlowType, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderNetworkServicesBase.AcquireTokenWithPromptInternalAsync(String resource, String tenant, UserIdentifier userId, String queryParameters, AuthenticationFlowType authenticationFlowType, Dictionary`2 additionalAuthProperties, CancellationToken cancellationToken)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderService.CreateAccountInnerAsync(String userName, String queryParameters, AuthenticationFlowType authenticationFlowType, Dictionary`2 additionalAuthProperties, Boolean homeTenantOnly, CancellationToken cancellationToken)
	StatusCode: 0 
	ResponseBody:  
	Headers: '

Expected behavior

No response

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions