Solved

problem with GraphQL auth | NodeJS

  • 11 May 2021
  • 2 replies
  • 615 views

Hi there:

I’m trying to make querys from a server using NodeJS and always get error 401 “you are not authorized to access this page” 

 

const url = 'https://api.pipefy.com/graphql';

const options = {

method: 'POST',

headers: {

Authorization: '***MY_TOKEN***',

'Content-Type': 'application/json'

},

body: JSON.stringify({query: '{ me { name } }'})

}

 

 The thing is, I'm using the example in the documentation but it doesn't work. What I am doing wrong?

 

 

icon

Best answer by Mayara Rasini 12 May 2021, 18:55

View original

2 replies

Hi! 
You need to use Bearer before your token, like this:
"Authorization": "Bearer YOUR_TOKEN", "Content-Type": "application/json"

Thanks Mayara. It solves the issue.

 

I think in the reference is not clear enough:

https://developers.pipefy.com/reference#graphql-endpoint

 

Thanks! Now I’m starting my integration.

Reply