Instagram: redirect URI does not match registered redirect URI
Mistake
{"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 would be appreciated. Thank!
source to share
You will need to url encode the parameter value redirect_uri
to http%3A%2F%2Flocalhost%3A8000
to exclude the parameter scope
becoming part of the value redirect_uri
instead of requesting authorization.
You also need to make sure it redirect_uri
matches exactly, including the last slash you registered it with.
So the authorization request becomes:
https://instagram.com/oauth/authorize?response_type=code&client_id=2fa4359e4340434786e469ab54b9b8c0&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=likes
source to share
Please check this answer
Basically you need to set your redirect URI in both your app and Instagram: ig <CLIENT_ID>: // authorization
In all cases, you need to add / authorize or something like that, somehow Instagram doesnβt only allow a site without a subdomain.
source to share