Skip to content

Instantly share code, notes, and snippets.

@babaktaremi
Created August 23, 2021 07:20
Show Gist options
  • Save babaktaremi/819ea908c598a7b2e74b5c1d084ad32d to your computer and use it in GitHub Desktop.
Save babaktaremi/819ea908c598a7b2e74b5c1d084ad32d to your computer and use it in GitHub Desktop.
namespace ChatApplication.Shared.Jwt
{
public class AccessToken
{
[JsonConstructor]
public AccessToken()
{
}
public string access_token { get; set; }
public string token_type { get; set; }
public int expires_in { get; set; }
public AccessToken(JwtSecurityToken securityToken)
{
access_token = new JwtSecurityTokenHandler().WriteToken(securityToken);
token_type = "Bearer";
expires_in = (int)(securityToken.ValidTo - DateTime.UtcNow).TotalSeconds;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment