Focuses on API authentication, access scopes, and permission management.
Hi folks,
I'm attempting a test API call to the customer account API with OAuth2 using Insomnia. I can acquire the access token, but when I attempt to use it I get "Not a valid access token".
The token is not expired, I use it shortly after it's acquired and it has almost 2 hours before expiration. I'm making a POST request. I'm not sure which URL I should be hitting, though I've tried both the shop url
https://my-shop-name.myshopify.com/api/2024-01/graphql.json
which I use to successfully access the storefront API, and I've tried the url suggested in the docs under endpoints and queries which is
https://shopify.com/<shop_id>/account/customer/api/unstable/graphql.
The headers are Content-Type : application/json; Authorization : Bearer *token*
I'm using this json formatted graphql query
{"query": "query { customer { email } }"}
though I've also attempted using a structured graphql query.
The result of the request is
{
"errors": [{
"message": "",
"extensions": {
"code": "ACCESS_DENIED"}}]
}
Any advice is appreciated
Kind regards
Are you trying to create a customer? If so you should be making the PUT request to /admin
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hey, did you work this out in the end? I'm running into the same issue.
@Liam in my case, I'm trying to fetch information about a customer, order history etc.