Hi guys!! I've created an api token to use with REST API. I pass it by header Authentication and everything works fine:
curl 'https://myspace.atlassian.net/rest/api/3/users/search?maxResults=1000' \
-H 'Connection: keep-alive' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' \
-H 'Accept: */*' \
-H 'Authorization: Basic base64<user:token>' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36' \
-H 'Origin: http://localhost:3000' \
-H 'Sec-Fetch-Site: same-site' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: http://localhost:3000/' \
-H 'Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7' \
-H 'x-elastica_gw: 3.116.0' \
--compressed
But when I try to call an GRAPHQL endpoint I receive a forbidden error.
I thought the token was the same for both APIs, isn't it?
If it is not, where can I create a token for GRAPHQL API?
Here is my curl for GRAPHQL
curl 'https://myspace.atlassian.net/gateway/api/directory/graphql?q=UserDetails' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' \
-H 'Accept: */*' \
-H 'Referer: http://localhost:3000/' \
-H 'Authorization: Basic base64<user:token>' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36' \
-H 'Content-Type: application/json' \
--data-raw $'{"operationName":"UserDetails","variables":{"userId":"1234","cloudId":"1234"},"query":"query UserDetails($userId: String\u0021, $cloudId: String\u0021) {\\n CloudUser(userId: $userId, cloudId: $cloudId) {\\n id\\n fullName\\n isCurrentUser\\n title\\n department\\n companyName\\n location\\n timezone\\n email\\n phoneNumber\\n remoteWeekdayIndex: localTime(format: \\"d\\")\\n remoteWeekdayString: localTime(format: \\"ddd\\")\\n remoteTimeString: localTime(format: \\"h:mma ([GMT]Z)\\")\\n __typename\\n }\\n}\\n"}' \
--compressed