Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Authorization issues with GRAPHQL

KB
Contributor
March 14, 2024

Hi,

I want to build an export for insights from JPD, given the product does not offer any method of it. I found it hard to leverage the graphql API but managed to put together the components in GraphQL explorer.

Now trying this in a node app, I get the error:

Auth category: UNAUTHENTICATED is not allowed in service polaris

This is how I put together the request:

I also copy the token from https://id.atlassian.com/manage-profile/security/api-tokens

const response = await fetch('https://MYINSTANCE.atlassian.net/gateway/api/graphql', {
        method: 'POST',
        headers: {
          Authorization:'TOKENcopiedFROM-https://id.atlassian.com/manage-profile/security/api-tokens',
          'Content-Type': 'application/json',
          'X-ExperimentalApi':'polaris-v0',
        },
        body: JSON.stringify({
          query: `query myquery {
            polarisInsights(project: "ari:cloud:jira:MYCLOUDID:project/PROJECTID",
                    container:"ari:cloud:jira:MYCLOUDID:issue/`+id+`") {
                      id
                  }
                }`
        }),
      });

Not sure about the Token format, but from what I found this would be it.

 

I appreachiate any help!

2 answers

1 accepted

0 votes
Answer accepted
KB
Contributor
March 26, 2024

I found the solution. Unfortunately the documentation is really bad for this. With the help from the support team i figured the resolution:

First, the domain you use does not matter.

Second the authorization:

'Authorization':"Basic InserTokenHere"
and the token needs to be created by this string in  base64 encoding:
your@emailaddress.com:MYTOKEN-copied-from-https://id.atlassian.com/manage-profile/security/api-tokens
0 votes
Hermance NDounga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 15, 2024

Hello can you please try using this URL https://api.atlassian.com/graphql instead  of 

https://MYINSTANCE.atlassian.net/gateway/api/graphql 

it should work :) 

Cheers, 

Hermance 

KB
Contributor
March 16, 2024

Thanks Hermance, unfortunately it does not change a thing.

How should the Authentication be formated?

 

Thanks & Best

Kornelius

KB
Contributor
March 19, 2024

@Hermance NDounga Can you share some details o n the Aut token format, or if there is anything else to consider here?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, confluence for marketers, atlassian community events, ace, confluence training, confluence marketing workflows, atlassian learning, marketing tools, content marketing, marketing pm, atlassian live learning, confluence for teams​

Great marketing starts with Confluence. Join our live learning sessions to learn how! 📹

Join our 3-part live learning series with community leader Robert Hean to master how to leverage Confluence for Marketing teams. Learn how to plan and execute on projects seamlessly and how to turn insights into lasting organizational knowledge. 🧠

Register today!
AUG Leaders

Atlassian Community Events