如何通过oauth2.0获取令牌密钥

时间:2018-09-10 16:52:52

标签: jquery ajax oauth-2.0

我正在使用AJAX获取令牌密钥,然后转移到另一个页面以检查令牌访问密钥是否已生成。这是我的代码。我收到的错误是“错误的请求状态”。

function Login() {
  var mod = {
    UserName: $("#name").val(),
    Password: $("#pass").val(),
    grant_type: 'password'
  }

  $.ajax({
    url: '/token',
    method: 'Post',
    data: JSON.stringify(mod),
    contentType: 'application/x-www-form-url;',
    success: function(response) {
      sessionStorage.setItem('accessToken', response.access_token);
      window.location.href = "Data.html";
    },
    error: function(response) {
    }
  })

0 个答案:

没有答案