Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么Github';s GraphQL API 401与Axios兼容?_Javascript_Github_Graphql_Axios - Fatal编程技术网

Javascript 为什么Github';s GraphQL API 401与Axios兼容?

Javascript 为什么Github';s GraphQL API 401与Axios兼容?,javascript,github,graphql,axios,Javascript,Github,Graphql,Axios,我试图使用axios获取github的graphQL端点,但它总是说我没有授权: const handleClick = token => event => axios.get("https://api.github.com/graphql", { headers: { "Authorization": "bearer" + token} }).then(response => console.log(response)) 我得到了这个错误: GET http

我试图使用
axios
获取
github的graphQL端点,但它总是说我没有授权:

const handleClick = token => event =>
  axios.get("https://api.github.com/graphql", {
    headers: { "Authorization": "bearer" + token}
  }).then(response => console.log(response))
我得到了这个错误:

GET https://api.github.com/graphql 401 (Unauthorized)
bundle.js:1475 Uncaught (in promise) Error: Request failed with status code 401
    at createError (bundle.js:1475)
    at settle (bundle.js:1619)
    at XMLHttpRequest.handleLoad (bundle.js:1028)
createError @ bundle.js:1475
settle @ bundle.js:1619
handleLoad @ bundle.js:1028
您需要在“持票人”和您的代币之间留一个空格:

"bearer " + token
您需要在“持票人”和您的代币之间留一个空格:

"bearer " + token