redirect_uri is not whitelisted, when it is

Highlighted
New Member
2 0 0

Hello, we're working on building an embedded app. We're using the shopify omniauth gem along with Devise to handle the oauth process on our end. We're also tunnelling into localhost via ngrok as suggested in the getting started guide. However it looks like the shopify API doesn't like our redirect url.

Here's the whitelist in our app settings (the Redirection URL field):

"https://f9302390.ngrok.io/auth/shopify/callback/
https://f9302390.ngrok.io/users/auth/shopify/callback/";

Note that we've tried just one line or the other line. Devise is prepending /users/ to all oauth routes which is why we aren't using the default auth/shopify route.

When we click our app, we get the "Oauth error invalid_request: The redirect_uri is missing or not whitelisted" error. However, the redirect_uri as shown in the params on the url of that page is: 

https%3A%2F%2Ff9302390.ngrok.io%2Fusers%2Fauth%2Fshopify%2Fcallback&response_type=code&scope=read_products&state=385eacf5162b9f9702f9e80651c16dc3d667ef49e53e7cc9

Which, decoded, matches one of the entries in the whitelist.

Our app has Shopify Web Admin enabled. Is there any other reason the shopify API can't find our callback url in the whitelist?

Thanks!

 

 

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
143 0 27

Hi Nick.

It looks like the whitelist entries that you posted have a trailing slash, yet there is no trailing slash in the redirect_uri. Have you tried whitelisting https://f9302390.ngrok.io/users/auth/shopify/callback (without the slash at the end)?

Josh

 

1 Like
Highlighted
New Member
2 0 0

Thanks Josh! It worked!

0 Likes
Highlighted
New Member
2 0 0

hi Josh

I am new around and I follow tutorial from shopify (https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/embed-your-app-in-shopify).

in progress I got same error => Oauth error invalid_request: The redirect_uri is not whitelisted when it comes to "Authenticate and test your app" section.

I have url https://1e6c101b2ffe.ngrok.io/ from ngrok both for App URL and Whitelisted Redirection URL. 

I think my problem is now I can't delete last slash. even if I delete it, it comes back when I click save.

what do you think?

0 Likes