Redirect when OAuth fails

Solved
MarcoS9
New Member
1 0 0

Hello, 


We are looking to develop a public standalone shopify app. We let the user input his shop url, and use it to generate the link needed to ask the permission to install the app in his shopify admin.
If the shop name is incorrect, the url redirects to a "Sorry this shop is unavailable" shopify page, is there a way to then redirect the user back to our callback url so we can handle the error and tell the user what went wrong?

Thank you for the help

 

0 Likes
Milkbottlelough
Tourist
10 1 7

This is an accepted solution.

Hi MarcoS9,

I don't think this is possible as you describe it.

One solution would be to implement a check on your app's side to do a quick ping to the xxxxx.myshopify.com URL that the user has inputted before you kick off the installation process.  If you get back a 404 status response you know there is no shop at that URL and you can display an error.  If you get a 200 status response then a shop exists so proceed with the install.

Another approach would be to check the response header for the x-shopid - the shopify 404 page you mentioned returns an empty x-shopid value but if there is a shop there it will return the Shop ID.  So you can do a similar conditional check on that and then handle the response by either showing an error to the user if x-shopid is null or proceeding with the installation if there is a value set.

Hope that helps,

L.

0 Likes