title: Call for MVC 5 Web Api 2 Refresh Token from the Jquery Ajax
body: <p>I am using MVC 5 Web Api 2 with individual user account authentication. I have set the access token expiration of 30 days.</p>
  <pre><code>       OAuthOptions = new OAuthAuthorizationServerOptions
          {
              TokenEndpointPath = new PathString(&quot;/Token&quot;),
              Provider = new ApplicationOAuthProvider(PublicClientId, UserManagerFactory),
              AuthorizeEndpointPath = new PathString(&quot;/api/Account/ExternalLogin&quot;),
              AccessTokenExpireTimeSpan = TimeSpan.FromDays(30), // Expiration 30 Days 
              AllowInsecureHttp = true
          };
  </code></pre>
  <p>But my access token gets expires early (i think it expires after 9-10 hours). So i want to call jquery ajax for refresh token  &quot; /Token &quot;. I refered <a href="https://www.rfc-editor.org/rfc/rfc6749#section-6" rel="nofollow noreferrer">RFC6749</a> From this artical i created ajax :-</p>
  <pre><code>var data = &quot;refresh_token=&quot;+refresh_token;
  data = data + &quot;&amp;grant_type=refresh_token&quot;   
  $.ajax({
      type: 'post',
      url: &quot;/Token&quot;,
      data: data,
      Content-Type: application/x-www-form-urlencoded
      success: function (data) {
       saveAccessToken(data);
      }
  });
  </code></pre>
  <p>I have created GrantRefreshToken in &quot; ApplicationOAuthProvider.cs &quot; also</p>
  <pre><code> public override Task GrantRefreshToken(OAuthGrantRefreshTokenContext context)
      {
          return base.GrantRefreshToken(context);
      }
  </code></pre>
  <p>When call the ajax I am getting error of invalid grant_type. No Clue why? Please help. Thanks in advance</p>