【发布时间】:2018-11-15 16:00:22
【问题描述】:
我在 Web API 中使用基于令牌的身份验证来对用户进行身份验证。我正在使用客户端浏览器会话存储来存储访问令牌。这样做安全吗? 我应该把它存放在哪里更安全。
$('#btnLogin').click(function () {
$.ajax({
// Post username, password & the grant type to /token
url: '/token',
method: 'POST',
contentType: 'application/json',
data: {
username: $('#txtUsername').val(),
password: $('#txtPassword').val(),
grant_type: 'password'
},
//response(Access Token) stores inside session storage of Client browser.
success: function (response) {
sessionStorage.setItem("accessToken", response.access_token);
【问题讨论】:
标签: asp.net-web-api oauth access-token