Created
August 23, 2021 07:20
-
-
Save babaktaremi/819ea908c598a7b2e74b5c1d084ad32d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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