返回Undefined的VueJs的Auth0授权API

时间:2018-04-02 05:11:59

标签: api vue.js auth0

我正在尝试为Auth0授权扩展实现授权API。我按照这里的指南(https://auth0.com/docs/api/authorization-extension?http#introduction

进行了跟踪

我能够成功获得access_token。 但是当我使用访问令牌调用Api时,我只能得到“未定义”的信息。有401未经授权的错误。

以下是我的VueJs应用程序的main.js文件中的相关代码

let ACCESS_TOKEN = ''
axios.post('https://georgeprep.auth0.com/oauth/token', config.body, config.headers)
.then(response => {
  ACCESS_TOKEN = response.data.access_token
console.log(response);})
.then(response => {
  const AuthString = 'Bearer '+ (ACCESS_TOKEN)
  axios.get(
  'https://georgeprep.us.webtask.io/adf6e2f2b84784b57522e3b19dfc9201/api/users',
{ authorization : AuthString})})
.then(object => {
  console.log(object)})

图片是我在console.log和我的API中的scopes获得的回复

0 个答案:

没有答案
相关问题