2017-06-17 5 views
0

私はaxiosを使用してGet githubののgraphQLのエンドポイントにしようとしているし、それが私の境界と私が認証されていないよと言って続けて:GithubのGraphQL APIがAxiosで401ingされているのはなぜですか?

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 

答えて

1

あなたが必要ベアラとあなたのトークンの間のスペース:

"bearer " + token 
関連する問題