Instagram:重定向URI与注册的重定向URI不匹配



错误

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

出现在上

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

Instagram设置

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

代码

$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'
});

任何帮助都将不胜感激。谢谢

您需要将redirect_uri参数的值URL编码为http%3A%2F%2Flocalhost%3A8000,以防止scope参数成为redirect_uri值的一部分,而不是授权请求。

您还必须确保redirect_uri完全匹配,包括您注册的最后一个斜杠。

因此,授权请求变为:

https://instagram.com/oauth/authorize?response_type=code&client_id=2fa4359e4340434786e469ab54b9b8c0&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=likes

当您使用Instagram创建开发者帐户时,系统会提示您输入重定向URI。您在应用程序中用于身份验证的重定向URI必须与注册的URI匹配。

请检查此答案

基本上,您需要在应用程序和Instagram中将重定向URI设置为:ig<CLIENT_ID>://授权

在所有情况下,你都需要附加/授权或类似的东西,不知何故,Instagram不允许只有一个没有子域的网站。

最新更新