Not receiving redirect URL from Shopify OAuth

Solved

Not receiving redirect URL from Shopify OAuth

caelstewart
Shopify Partner
6 0 1

Hey,

 

I'm trying to redirect to my server with the code and the other query parameters to save them on behalf of the user, but I've never gotten a hit back during OAuth. I've dumbed it down as much as possible and still nothing.

 

Help would be appreciated - thanks.

 

Screenshot 2024-02-05 at 6.37.12 PM.pngScreenshot 2024-02-05 at 6.36.53 PM.pngScreenshot 2024-02-05 at 6.36.45 PM.png

Accepted Solution (1)
YOD_Solutions
Shopify Partner
246 25 35

This is an accepted solution.

The same applies when your app is installed from the app store. You will need to redirect them to this url for installation: https://${shop}/admin/oauth/authorize?client_id=${client_id}&scope=${scopes}&redirect_uri=${redirectUri}&state=${nonce}, where redirectUri is your url, where your logic for requesting access token resides. Then, Shopify will include a temporary code as part of redirectUri during the OAuth process and redirect it, which you will use to request for access token.

 

These two docs elaborate this:  Implement authorization code grant manually (shopify.dev)   and https://shopify.dev/docs/apps/auth/get-access-tokens/authorization-code-grant

 

Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store

View solution in original post

Replies 5 (5)

YOD_Solutions
Shopify Partner
246 25 35

If I understand your question correctly, your app needs to do the redirection during installation - it does not happen automatically.  

`https://${shop}/admin/oauth/authorize?client_id=${client_id}&scope=${scopes}&redirect_uri=${redirectUri}&state=${nonce}`
Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store
caelstewart
Shopify Partner
6 0 1

Thanks for the reply. So that's what I thought at first, but when the app is public in the app store doesn't Shopify manage all of that on their end? They click to install the app, Shopify pops up that authorize link on their end and then when it's installed it calls my callback URL.

caelstewart
Shopify Partner
6 0 1

Your response works which makes sense, I just don't understand the flow then. I figured when a user clicks on our app in the app store Shopify automatically handles the authorize link part because if it's on me to do it where am I supposed to redirect? Hope that makes sense.Screenshot 2024-02-06 at 3.03.36 PM.png

YOD_Solutions
Shopify Partner
246 25 35

This is an accepted solution.

The same applies when your app is installed from the app store. You will need to redirect them to this url for installation: https://${shop}/admin/oauth/authorize?client_id=${client_id}&scope=${scopes}&redirect_uri=${redirectUri}&state=${nonce}, where redirectUri is your url, where your logic for requesting access token resides. Then, Shopify will include a temporary code as part of redirectUri during the OAuth process and redirect it, which you will use to request for access token.

 

These two docs elaborate this:  Implement authorization code grant manually (shopify.dev)   and https://shopify.dev/docs/apps/auth/get-access-tokens/authorization-code-grant

 

Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store
caelstewart
Shopify Partner
6 0 1

I'd seen the second link but not the first one that explains what you just described to me. Thank you for your time - I appreciate it!