Oauth error invalid_request: The redirect_uri is not whitelisted

I’m creating my APP on shopify but the error Oauth error invalid_request: The redirect_uri is not whitelisted is happening when installing

I have all of these URLs listed in my app:

https://app.emanda.com.br/shopify/cadastro/
https://app.emanda.com.br/

The URL of my APP is https://app.emanda.com.br/shopify/cadastro/

The Url that is presenting the error is

https://emandadesenvolvimento.myshopify.com/admin/oauth/request_grant?client_id=d58ee324fa8c9ae989054a32ca65d3b4&grant_options%5B%5D=per-user&redirect_uri=https%3A%2F%2Fapp.emanda.com.br%2Fshopify%2Fcadastro%2Fcadastro.php&scope=read_orders%2Cread_products%2Cread_customers

I don’t know where else to look for the error, does anyone have any suggestions?

Your redirect URI appears to include a specific URL path and a PHP page extension. All you need is a shorter version. Like https://thewebsite.com or https://thewebsite.com/path And ensure that the redirect URI exactly matches what you have defined in the app as whitelisted redirect points.

2 Likes

Tnks @Gregarican your suggestion solved our problem

Not sure what is the problem with my app.

In App setting defined redirection URL and same URL is presented in OAuth URL.


Could you please help me to resolve this issue?

3 Likes

Hi,

Was your problem resolved? I am also having exactly the same problem.

regards.

Talal

Same problem for me, and i just following this tutorial: https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/embed-your-app-in-shopify

3 Likes

Same for me. Did you manage to get your issue sorted in the end? Thanks

HI,

I managed to resolve this issue in the end. This issue has literal meaning. Basically, the exact URL needs to be added to the whitelisted section.

having the same issue too

I tried adding these to Allowed Redirection URLs in App Setup:


[https://0dac1902ba96.ngrok.io/auth/callback](https://0dac1902ba96.ngrok.io/auth/callback)

[https://tutorial-store-mx.myshopify.com/admin/oauth/authorize?client_id=cb02ce7a4c7655a4adfdd2bedb77a066&scope=read_products&redirect_uri=https://http://0dac1902ba96.ngrok.io/auth/callback](https://tutorial-store-mx.myshopify.com/admin/oauth/authorize?client_id=cb02ce7a4c7655a4adfdd2bedb77a066&scope=read_products&redirect_uri=https://http://0dac1902ba96.ngrok.io/auth/callback)

All of which still gave the same error:

Oauth error invalid_request: The redirect_uri is not whitelisted

What am I missing?

https://403d432e76bb.ngrok.io/?shop=sample-embedded-app-xyz.myshopify.com was my uri path it should be exact as u have stated in your app setup page

if this does not help check your api key are matching in app as well as your development environment (mine is Visual studio code)

Hope this information helps bcoz this is a pain in a**.

1 Like

I was having this issue because I was running this and not making use of ngrok, as it keeps breaking midway as I test my app. I have my own local proxy I am making use of, but I had forgotten to update the host in myproject’s env file. Check if the whitelisted URL in the app settings matches the host URL. Otherwise it will fail.

============================denial of service ===============================
Oops, something went wrong.

What happened?
Oauth error invalid_request: The redirect_uri is not whitelisted
What can I do?
Press the back button on your browser.
Return to your admin dashboard.

This error is normally caused by …

ws 5.0.0 - 5.2.2 || 6.0.0 - 6.2.1 || 7.0.0 - 7.4.5
Severity: moderate
Regular Expression Denial of Service - https://npmjs.com/advisories/1748
fix available via npm audit fix
node_modules/ws

fix available via npm audit fix
node_modules/ws

15 vulnerabilities (13 moderate, 2 high)

open CMD

=>npm audit fix

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:

use if you have to with extra care.

npm audit fix --force

added 62 packages, removed 409 packages, changed 90 packages, and audited 1667 packages in 1m

41 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

Once you get 0 vulnerabilities, you should be able to have access again!

Re-check your API key & secret.

Somehow it was changed by itself in settings, while i was updating new ngrok url.

I dont know how it happened, but it took 3 hours of my life)

3 Likes

Url’s like what can you give examples ?

This turned out to be my problem. Very cryptic. Thank you!

Other things to check - Check that you have entered the correct API key and secret key in your app.

Thanks.

  • Have you solved it yet?

This page is the first result on Google, for any future visitor the thing that fixed to me was the trailing slash in the HOST environment key that needs to go away. This was in a nodejs/react bridge embedded app.

EG: HOST=[https://myapp.com/](https://myapp.com/) needs to be HOST=[https://myapp.com](https://myapp.com)

https://www.url-encode-decode.com/
When you get that error look at the url string in the browser bar. There is a redirecturl url param. Copy and past that into the url site, and you can see what the redirect url its attempting to use is. I found for example mine had https in it twice, and had to modify some api parameters.
Reach out to me at https://tlchatt.com if you have any questions.

2 Likes