我正在创建一个MVC网页,它利用RestSharp进行身份验证并返回令牌。
当请求令牌时,成功的响应会返回以下内容:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"example",
"expires_in":3600,
"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
"example_parameter":"example_value"
}
' expires_in'内容存储在C#中,以便每次进行调用和检查时都可以使用它?因为,只有在时间用完时才需要进行refresh_token调用
我知道它可以存储在模型类中,但是这总是会保存为设置值吗?我相信每次调用这个类时都会重置这些值吗?
public class TokenResponse
{
public string access_token { get; set; }
public string token_type { get; set; }
public string expires_in { get; set; }
public string refresh_token { get; set; }
public string example_parameter { get; set; }
}