Oauth error invalid_request: The redirect_uri is not whitelisted

Solved

Oauth error invalid_request: The redirect_uri is not whitelisted

IuriMoura
Shopify Partner
5 0 0


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=d58ee324fa8c9ae98905...

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

Accepted Solution (1)

Gregarican
Shopify Partner
1033 86 287

This is an accepted solution.

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.

View solution in original post

Replies 26 (26)

Gregarican
Shopify Partner
1033 86 287

This is an accepted solution.

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.

IuriMoura
Shopify Partner
5 0 0

Tnks @Gregarican your suggestion solved our problem

rony36
Shopify Partner
5 0 3

Not sure what is the problem with my app.

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

Screen Shot 2021-01-24 at 3.08.44 PM.png

 

Screen Shot 2021-01-24 at 3.09.39 PM.pngCould you please help me to resolve this issue?

talalbsse
Shopify Partner
10 0 6

Hi,

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

 

regards.

Talal

Albume
Visitor
1 0 3
Matty3
Excursionist
15 0 2

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

talalbsse
Shopify Partner
10 0 6

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. 

mxie
Visitor
1 0 0

having the same issue too

 

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

```

https://0dac1902ba96.ngrok.io/auth/callback

https://tutorial-store-mx.myshopify.com/admin/oauth/authorize?client_id=cb02ce7a4c7655a4adfdd2bedb77...

```

 

All of which still gave the same error:

> Oauth error invalid_request: The redirect_uri is not whitelisted

 

What am I missing?

Prajwal_Adhav
Visitor
2 0 1

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

Prajwal_Adhav_0-1618400945472.png

Prajwal_Adhav_1-1618400960490.png

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**.

 

Vukona
Tourist
7 0 1

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.

Mnisi V
Fessy
Visitor
1 0 0

============================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!

erik7z
Visitor
3 0 3

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)

ckm
Shopify Partner
1 0 0

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

Vanfigs
Shopify Partner
11 0 6

Thanks.

Manjeety87
Visitor
1 0 0

Url's like what can you give examples ?

 

cornnnnnnnnnnnn
Shopify Partner
2 0 0
  • Have you solved it yet?

kusimo
Shopify Partner
8 0 6

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

deimos_ind
Shopify Partner
2 0 0

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/` needs to be `HOST=https://myapp.com`

Technologic
Shopify Partner
8 0 8

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.

joe-at-lunaris
Shopify Partner
1 0 0

You are an awesome person.   Thank you

zksumon
Shopify Partner
9 0 1

this is the best answer for me.

thanks a lot man.

saqibrashid
Shopify Partner
2 0 0

I am getting this redirect_uri: https://not_defined/api/auth/callback, any idea what is the issue ?

zksumon
Shopify Partner
9 0 1

@saqibrashid wrote:

I am getting this redirect_uri: https://not_defined/api/auth/callback, any idea what is the issue ?


Can you show your code ?

saqibrashid
Shopify Partner
2 0 0

https://stackoverflow.com/questions/77222877/php-shopify-app-redirect-uri-oauth-error-invalid-reques...
You can find the details here. If there is any specific piece of code you want you can ask. Thanks for showing concern, I really appreciate it.

Mahfuzrrm
Shopify Partner
1 0 0

This is still the best solution I have ever received.

I just had to remove the duplicated encoded https:// and wala the issue has gone.

 

ndt_ts
Shopify Partner
25 2 7

For those trying to run their apps in cli-3, you would have set the 

SHOPIFY_APP_URL in your environment variable.

Ensure the app url you have set in App setup and 
SHOPIFY_APP_URL variable which you are setting in your .env are same.

Sometimes you might use ngrok for quick testing and you would have failed to update the 
SHOPIFY_APP_URL variable.

Hope this helps