I’m developing an app for Shopify. Currently under development stage. Until now, I have successfully managed to authorise the app and then redirect it back to admin page using the Embedded App SDK. However, when I return to the admin page, it gives me an error saying Request origin cannot be verified
.
The console shows Failed to load resource: the server responded with a status of 403 (Forbidden)
The URL in the console is something like this https://myshop.myshopify.com/admin/apps/dfdjf4343343434343434bfdf/shopify/shopify/callback?code=ffdfdffd&hmac=fdfdfdfdfdfdfdfdfddfdfdfdfdf&shop=myshop.myshopify.com&state=151193864548800×tamp=1511938648
The fdfdfdfdfdfdfdfdfddfdfdfdfdf
are just random characters that I’ve replaced instead of a hash. FYI – I’ve removed the app name and user profile name and avatar from the image.
3
Answers
This is happening because, you are unable to match state, that is set in cookie, while responding with redirect url
Simple as this is, also make sure that the protocol matches from what you typed in to start the app install.
If you accidentally use
http
forhttp://you.ngrok.io/
but your callback redirects tohttps
(i.e.https://you.ngrok.io/auth/callback
), the OAuth handshake will fail.