title: Oauth 2.0 RestSharp passing accesstoken
body: <p>Following on from my last question I have made some progress but still stuck</p>
  <p>I am able to obtain the accessToken using this SetUp method in the test class</p>
  <p>but when I try to run the test CanGetAllCountries it still says it is unauthorized</p>
  <p>How can i pass the accessToken to authorize the second test?</p>
  <pre><code>public class APITestCustomer
  {
      public static string baseUrl = &quot;https://www.example.net/umbraco/api/&quot;;
      
  
  [SetUp]
  public void OAuthLogonSetup()
  {
  
      var client = new RestClient(baseUrl);
      RestRequest request = new RestRequest(&quot;UsersApi/Logon&quot;) { Method = Method.POST };
      request.AddHeader(&quot;Accept&quot;, &quot;application/json&quot;);
      request.AddHeader(&quot;Content-type&quot;, &quot;application/x-www-form-urlencoded&quot;);
      request.AddParameter(&quot;Username&quot;, &quot;xxxxxx&quot;);
      request.AddParameter(&quot;Password&quot;, &quot;xxxxxx&quot;);
      request.AddParameter(&quot;grant_type&quot;, &quot;client_credentials&quot;);
  
      var response = client.Execute(request);
      var responseJson = response.Content;
      var token = JsonConvert.DeserializeObject&lt;Dictionary&lt;string, object&gt;&gt;(responseJson)[&quot;accessToken&quot;].ToString();
  
      //Assert.That(token.Contains(&quot;test&quot;));
  
  }
  
  
          [Test]
          public void CanGetAllCountries()
          {
              
              RestClient client = new RestClient(baseUrl);
              RestRequest request = new RestRequest(&quot;CountryApi/GetAll&quot;, Method.GET);
              request.AddHeader(&quot;Authorization&quot;, &quot;Bearer&quot;);
              IRestResponse response = client.Execute(request);
              Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
          }
  
      }
  }
  </code></pre>