Reputation: 67
I want to retrieve data from github's graphql api but I keep getting error message:
{ message: 'This endpoint requires you to be authenticated.', documentation_url: 'https://docs.github.com/v3/#authentication' }
Despite using a token, I even generated a new token to see if the other one was broken. The script to fetch the data can be found at https://repl.it/@DukeSanmi/AcrobaticModernLanguage#index.js
What could be the issue?
Upvotes: 1
Views: 1154
Reputation: 417
Okay you need to put a space between bearer
and your variables.githubToken
like so:
const headers = {
'Content-Type': 'application/json',
'Authorization': 'bearer ' + variables.githubToken
};
Furthermore, NEVER publish secrets/credentials like API tokens in public code!
Upvotes: 5