I'm trying to make a request with generated git token, but it seems like I'm making a wrong authentication, what am I doing wrong? Thanks
const token = 'my github token'
fetch('https://api.github.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'bearer' + token
},
body: JSON.stringify({ query: QUERY })
})
.then(res => res.json())
.then(data => console.log(data))
}
Error message:
{message: 'This endpoint requires you to be authenticated.'}