title: VssUnauthorizedException VS30063 You are not authorized to access error suddenly thrown
body: <p>i have the following code that uses VSTS Client Side API's that was working but now returns an error of:
  <strong>Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: 'VS30063: You are not authorized to access <a href="https://XXXXXX.visualstudio.com" rel="nofollow noreferrer">https://XXXXXX.visualstudio.com</a>.</strong></p>
  
  <p>Here is the current C# code:</p>
  
  <pre><code>var vstsUrl = "https://XXXXXX.visualstudio.com";
  
  var vssClientCred = new VssClientCredentials
  {
    Storage = new VssClientCredentialStorage(),
    PromptType = 
    Microsoft.VisualStudio.Services.Common.CredentialPromptType.PromptIfNeeded
   };
  
  var connection = new VssConnection(new Uri(vstsUrl), vssClientCred);
  var projectHttpClient = connection.GetClient&lt;ProjectHttpClient&gt;();
  var listOfProjects  = projectHttpClient.GetProjects().Result;
  </code></pre>
  
  <p>The error gets thrown when an attempt to the GetClient method is invoked.</p>
  
  <p>Here is what I have tried so far with no luck:</p>
  
  <ul>
  <li>Sign out of web portal for VSTS</li>
  <li>Clear browser cache</li>
  <li>Tested whether I have access to VSTS through Visual Studio 2017 in the web browser window,  I can successfully log in </li>
  <li>Sign out of the account </li>
  <li>Clear browser cache</li>
  <li>Restart Visual Studio 2017</li>
  <li>Restart the machine*</li>
  </ul>
  
  <p>The code works on a different machine that is running Visual Studio 2017 so I don't think it's my user account. After it worked on that machine, I cleared the browser etc on that machine and went back to my main machine, tried the code again and the error still gets thrown.</p>
  
  <p>Any ideas what else I can try to resolve the error?</p>