【发布时间】:2018-01-12 16:51:36
【问题描述】:
我正在使用带有个人用户帐户身份验证的 MVC 5 Web Api 2。我已将访问令牌的有效期设置为 10 秒。
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromSeconds(10),
// In production mode set AllowInsecureHttp = false
AllowInsecureHttp = true,
RefreshTokenProvider = new SimpleRefreshTokenProvider()
我想调用 jquery ajax 来获取刷新令牌“/Token, 访问令牌过期后
$.ajax({
url: '/token',
method: 'POST',
contentType:'application/json',
data: {
username: $('#txtUserName').val(),
password: $('#txtPassword').val(),
grant_type:'password'
},
success: function (response) {
sessionStorage.setItem('accessToken', response.access_token);
window.location.href = 'Data.html';
}
}):
【问题讨论】: