title: Web api how to use the token send from the api
body: <p>have been digging this for 3 days and still cant find a good answer to this. Really appreciate if someone can help me out
  For example . A client use a login function from www.client.com to 
  My web api verified successfully and send a token to a user. How does the client use the token that api return  to access a method with </p>
  
  <pre><code> [RoutePrefix("api/Customer")]
  public class CustomerController : ApiController
  {
      List&lt;customer&gt; list = new List&lt;customer&gt;() { new customer {id=1 ,customerName="Marry",age=13},
          new customer { id = 2, customerName = "John", age = 24 } };
      [Route("GetExployeeByID/{id:long}")]
      [HttpGet]
      [Authorize]
      public customer GetExployeeByID(long id)
      {
          return list.FirstOrDefault(x =&gt; x.id == id);
      }
  }
  </code></pre>
  
  <p><strong>client script</strong></p>
  
  <pre><code>   function login() {
      $.ajax({
          url: 'http://www.azapi.com:81/token',
          contenttype: 'application/json',
          data: { username: 'admin@admin.com', password: 'P@ssw0rd', grant_type: 'password' },
          type: 'post',
          crossDomain: true,
          success: function (data) {
              sessionStorage.setItem('token', data.access_token)
          },
          error: function (err) {
              debugger
              alert('error')
          }
  
      })
  }
  
  function getEmployee() {
      $.ajax({
          url: 'http://www.azapi.com:81/api/customer/GetExployeeByID/1',
          datatype: "json",
          type: 'get',
          headers: {
              "access_token": sessionStorage.getItem("token")
          },
          crossDomain: true,
          success: function (data) {
              debugger
              alert(data.customerName)
          },
          error: function (err) {
              debugger
              alert('error')
          }
  
      })
  }
  </code></pre>
  
  <p>attribute method .  The client is calling the method usin Ajax from cross domain and my webapi already open the cros in webapi config and cros policy at web.config</p>