0

I cannot login into Visual Studio Community 2017. If I input my Microsoft Credentials this message pops out:

enter image description here

I have tried every single thing listed in similar questions like this: Visual Studio 2017 - How to fix error: We could not refresh the credentials for the account

But they don't work (tried to delete both the IdentityService folder contents and the folder itself; tried to repair through the installer) or can't be done (I can't access the "help" item menu: without logging in the whole application is locked).

Log file in

How can I fix this? C:\Users\user\AppData\Local\Temp\servicehub\logs\AadAccountProviderService-10304-v05lxa0n-1 shows:

09/27/2018 14:37:56 : Error : There was a problem getting the access token using the prompt with UI flow. Error: 'Microsoft.IdentityService.Clients.ActiveDirectory.AdalServiceException: AADSTS70002: Error validating credentials. AADSTS40016: The identity provider returned an error. The status returned was 'BadRequest' and the message was '{"error":"invalid_grant","error_description":"The user could not be authenticated or the grant is expired. The user must first sign in and if needed grant the client application access to the requested scope."}'.
Trace ID: fd00d736-cee6-4093-bce8-0aa4fff7c900
Correlation ID: 0dfc7dad-cb24-4b7f-9a9b-f926f9f7b493
Timestamp: 2018-09-27 12:37:56Z
   at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.VerifyAuthorizationResult()
   at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.<PreTokenRequest>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenHandlerBase.<RunAsync>d__57.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.IdentityService.Clients.ActiveDirectory.AuthenticationContext.<AcquireTokenCommonAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.IdentityService.Clients.ActiveDirectory.AuthenticationContext.<AcquireTokenAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Developer.IdentityService.AccountProvider.NetworkServicesImpl.<AcquireTokenWithPromptInternalAsync>d__21.MoveNext()
    ErrorCode: invalid_grant
    StatusCode: 0'
09/27/2018 14:37:56 : Error : CreateAccount: Creating an account. QueryParameters 'site_id=501454&display=popup&nux=1&lc=1033'
Account creation failed. 
Error: 'Microsoft.IdentityService.Clients.ActiveDirectory.AdalServiceException: AADSTS70002: Error validating credentials. AADSTS40016: The identity provider returned an error. The status returned was 'BadRequest' and the message was '{"error":"invalid_grant","error_description":"The user could not be authenticated or the grant is expired. The user must first sign in and if needed grant the client application access to the requested scope."}'.
Trace ID: fd00d736-cee6-4093-bce8-0aa4fff7c900
Correlation ID: 0dfc7dad-cb24-4b7f-9a9b-f926f9f7b493
Timestamp: 2018-09-27 12:37:56Z
   at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.VerifyAuthorizationResult()
   at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.<PreTokenRequest>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenHandlerBase.<RunAsync>d__57.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.IdentityService.Clients.ActiveDirectory.AuthenticationContext.<AcquireTokenCommonAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.IdentityService.Clients.ActiveDirectory.AuthenticationContext.<AcquireTokenAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Developer.IdentityService.AccountProvider.NetworkServicesImpl.<AcquireTokenWithPromptInternalAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderService.<CreateAccountAsync>d__25.MoveNext()
    ErrorCode: invalid_grant
    StatusCode: 0'
Saturnix
  • 10,130
  • 17
  • 64
  • 120

1 Answers1

1

Fixed this by opening a developer command prompt (Start menu -> developer command prompt) and running

Set SERVICEHUBTRACELEVEL=Verbose
devenv /log

This booted Visual Studio and I was able to login from there. For some reason I ignore this didn't cause the error message.

Saturnix
  • 10,130
  • 17
  • 64
  • 120