Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
markjercoates opened this issue Oct 24, 2024 · 7 comments
Labels
needs attention Delete label after triage public-client untriaged Do not delete. Needed for Automation

Comments

@markjercoates
Copy link

markjercoates commented Oct 24, 2024

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

@markjercoates markjercoates added needs attention Delete label after triage untriaged Do not delete. Needed for Automation labels Oct 24, 2024
@gladjohn gladjohn changed the title [Bug] [Bug] WAM Error - Account has previously been signed out of this application. Oct 24, 2024
@markjercoates
Copy link
Author

markjercoates commented Oct 24, 2024

I should add that I've tried clearing out my browser cache (Internet Edge), running a repair on my Visual Studio installation, deleting all files in the AppData\Local\.IdentityService directory and doing multiple machine restarts - without success. The error keeps appearing. I do not have any third party Virus programs running on my machine (Windows 11).

@iulico-1
Copy link
Contributor

@markjercoates, since this is a MsalUiRequiredException what happens when you call the interactive API ? This error occurs when user has signed-out from the app and the only way to sign the user back is to call AcquireTokenInteractive.

@markjercoates
Copy link
Author

Thanks for your reply. Can you tell me what you mean by calling the interactive API?

@rayluo
Copy link
Contributor

rayluo commented Oct 29, 2024

@markjercoates , did the error happen when your app calls a certain method in MSAL library, or did it happen just when you attempted signing in as a Visual Studio end user?

@markjercoates
Copy link
Author

markjercoates commented Oct 29, 2024

This is happening when I attempt to Sign In to Visual Studio with my Microsoft Email Account.
SignIn
Error

Note that as this represents my Microsoft Account I am able to manually SignIn into my Azure portal using the same email account. However, I have noticed I do occasionally get a message about multiple tenant subscriptions in the Azure Portal.

@iulico-1
Copy link
Contributor

@markjercoates, could you upgrade to Visual Studio Version 17.12 ? There was a fix released about a month back that addressed an issue with very similar symptoms.

@markjercoates
Copy link
Author

Thank you. I've upgraded to v 17.12 (preview) and this appears to have fixed the issue after several attempts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs attention Delete label after triage public-client untriaged Do not delete. Needed for Automation
Projects
None yet
Development

No branches or pull requests

4 participants