访问令牌的到期日期时间是多少?
What is the expiry date time of the access token?
当我们实施客户端凭据授权时 - Protecting an API using Client Credentials在客户端需要生成新的访问令牌之前,访问令牌可以使用多长时间(例如,到期日期是多少)?
创建客户端时,您可以定义访问令牌的生命周期
var myClient = new Client
{
ClientId = "testClient",
AllowedGrantTypes = GrantTypes.ClientCredentials,
ClientSecrets =
{
new Secret("secret".Sha256())
},
AllowedScopes = { "api1" },
AccessTokenLifetime=3600
};
如果您不提供 AccessTokenLifetime,那么它将默认为 3600,即一个小时。这意味着它将在创建后一小时过期
仅供参考,
JWT 的到期将表示为 Unix 纪元。
例如
{
"exp":1517988642,
...
}
等工具中查看
当我们实施客户端凭据授权时 - Protecting an API using Client Credentials在客户端需要生成新的访问令牌之前,访问令牌可以使用多长时间(例如,到期日期是多少)?
创建客户端时,您可以定义访问令牌的生命周期
var myClient = new Client
{
ClientId = "testClient",
AllowedGrantTypes = GrantTypes.ClientCredentials,
ClientSecrets =
{
new Secret("secret".Sha256())
},
AllowedScopes = { "api1" },
AccessTokenLifetime=3600
};
如果您不提供 AccessTokenLifetime,那么它将默认为 3600,即一个小时。这意味着它将在创建后一小时过期
仅供参考, JWT 的到期将表示为 Unix 纪元。
例如
{
"exp":1517988642,
...
}
等工具中查看