Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram: Redirect URI does not match registered redirect URI

Error

{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI does not match registered redirect URI"}

Appeared on

https://instagram.com/oauth/authorize?response_type=code&client_id=2fa4359e4340434786e469ab54b9b8c0&redirect_uri=http://localhost:8000&scope=likes

Instagram settings

CLIENT ID   2fa4359e4340434786e469ab54b9b8c0
WEBSITE URL http://localhost:8000/

Code

$authProvider.oauth2({
  name: 'instagram',
  url: 'http://localhost:3000/auth/instagram',
  redirectUri: 'http://localhost:8000',
  clientId: '2fa4359e4340434786e469ab54b9b8c0',
  requiredUrlParams: ['scope'],
  scope: ['likes'],
  scopeDelimiter: '+',
  authorizationEndpoint: 'https://api.instagram.com/oauth/authorize'
});

Any help will be appreciated. Thanks!

like image 881
Gaga Avatar asked Nov 28 '25 23:11

Gaga


1 Answers

You will need to URL encode the value of the redirect_uri parameter to http%3A%2F%2Flocalhost%3A8000 to prevent that the scope parameter becomes a part of the redirect_uri value instead of the authorization request.

You'll also have to make sure that the redirect_uri matches exactly, including the last slash that you've registered it with.

So then authorization request becomes:

https://instagram.com/oauth/authorize?response_type=code&client_id=2fa4359e4340434786e469ab54b9b8c0&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=likes
like image 129
Hans Z. Avatar answered Dec 01 '25 20:12

Hans Z.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!