Access token call redirects instead of returning token

OskarDO
New Member
2 0 0

When I try to obtain an access token for my app, instead of returning a

 

{ "access_token": "{{token}}", "scope": "{{scopes}}" },

 

I get a redirect:

(response code: 303)

<html><body>You are being <a href="https://{{shop}}.myshopify.com/admin/auth/login">redirected</a>.</body></html>.

 

My request is:

POST

https://{{shop}}.myshopify.com/admin/oath/access_token

 

Body:

{
"client_id": "{{app_key}}",
"client_secret": "{{app_secret}}",
"code": "{{authorization_code}}"
}

 

What am I doing wrong here?

Reply 1 (1)
AlexCXVideo
Shopify Partner
15 0 0

I know this is a delayed reply, but I literally spent a couple of hours trying to figure out what was going wrong with Postman.

I cannot say I fixed my challenge with Postman, but instead have just used cURL (windows subsystem for linux, mac will work too) to get the token back.

 

 

 

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"client_id": "<API key"","client_secret": "<API Secret>","code": "<code you received>"}' \
  https://<enter store name>.myshopify.com/admin/oauth/access_token

 

 

 

I then got the access token along with scope appoved.

 

 

{"access_token":"<my token>","scope":"write_orders"}

 

 

 

Shopify app maker and tech lead for https://apps.shopify.com/cx-video