Does GraphQL require a different AccessToken than the Rest API?

Solved
ChrisBoyd111
New Member
2 0 0

I have an app that uses the Rest API, and I was wanting to make a call to the GraphQL API to solve an issue I'm having due to API version changes.

I was planning on just calling GraphQL for this one feature and keeping Rest API for the others (due to the amount of work to switch the whole codebase) but when I call it using the same Access Token I get this error:

response: {"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}

 

 

0 Likes
Jason
Shopify Expert
10254 142 1940

This is an accepted solution.

I'd suggest you double check that you are authenticating correctly with whatever graphql library (or code) you're using. You should be able to use the same key without issue.

Have you tested the same call in a different testing tool like Postman (or similar) to rule out your tooling?

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
ToBas
New Member
2 0 0

I have the same issue - Rest API Key/Password does not work for GraphQL.

I tried Postman as well - the same API Key/Password for both Rest and GraphQL. GraphQL does not work (for example, X-Request-Id: 48415a30-77b5-40d5-8dc0-36f638146dcb).

In case of GraphQL it returns the following html

ToBas_0-1598542903247.png

 

0 Likes
ChrisBoyd111
New Member
2 0 0

Thanks for replying.  I feel foolish now, but it's been over 6 months since I worked on the Shopify App, and the access token I had was encrypted (the Rest API code decrypted it before sending).

0 Likes
ToBas
New Member
2 0 0

Ok, that helped:


Shopify access token

Private apps can authenticate with Shopify by including the request header X-Shopify-Access-Token: {access_token}, where {access_token} is replaced by your private app's Admin API password.


 

 

0 Likes