Ashok

Ashok

  • NA
  • 507
  • 80.9k

web api - how to decrease the length of access token in web api

Dec 24 2020 6:54 PM
Hi All,
 
How to decrease the length of access token as its looking lengthy.
 
ex:
 
{
"access_token": "hFF8AXzICSbcOLDSKwLUYcU6SNPL_r80SeJzKE0qQ3tMe0yPofn1IC7MwLb24p5xpK_s6OM0uVhE7q2LsSTlLjt9C9iRqnAKKOo6pSov1sa-OJpsFCmhR0rRiMDtgXBs5g-k3VZc_EsoXzAFK6wfY-xHMxG8pRujkTeY1_kja_nm-jr7Bie678vImXD8IbyRMnINL0qUQcBMUOt1LNCn0dnq5JxGZGZ1bUP8RfeNRU_Mi0MwoaMB0hNqAxiRZs92",
"token_type": "bearer",
"expires_in": 1799,
"refresh_token": "f6f75bf4-bc7b-4379-9da1-a4d14a09fae1",
".issued": "Thu, 24 Dec 2020 13:51:27 GMT",
".expires": "Thu, 24 Dec 2020 14:21:27 GMT"
}
 
code
  1. OAuthOptions = new OAuthAuthorizationServerOptions  
  2. {  
  3. TokenEndpointPath = new PathString("/oauth/2/token"),  
  4. Provider = new OAuthAppProvider(),  
  5. AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),//FromDays(2),  
  6. AllowInsecureHttp = true,// In production mode set AllowInsecureHttp = false  
  7. RefreshTokenProvider = new OAuthCustomRefreshTokenProvider() // We will create  
  8. };  

Answers (4)