{“error_type”:“OAuthException”,“code”:400,“error_message”:“无效的redirect_uri”}

Oğu*_*aya 7 php instagram

首先,这是我登录后的 Instagram URL:

\n\n
https://www.instagram.com/oauth/authorize?client_id=$MYCL\xc4\xb0ENT\xc4\xb0D&redirect_uri=https://localhost:4000/\xc4\xb0nstagram/Insta.php/&response_type=code&scope=user_profile,user_media\n
Run Code Online (Sandbox Code Playgroud)\n\n

这是页面向我显示的错误:

\n\n
\n

{“error_type”:“OAuthException”,“code”:400,“error_message”:“无效的redirect_uri”}

\n
\n\n

当我尝试从 Instagram 获取用户令牌时,出现该错误。
\n我尝试更改redirect_uri=(Valid OAuth Redirect URIs),但错误与以前相同。

\n

jso*_*son 7

我在任何地方都找不到这个记录,但通过反复试验,我发现redirect_uri必须:

  1. 使用https
  2. 可公开访问(例如本地主机和指定端口号不起作用)
  3. 不包含参数(我发现它们被删除,这会导致当我稍后请求访问令牌时redirect_uri不匹配)

  • 与本地主机一起工作 (2认同)

小智 6

实际上,对我来说,这是因为我的 URI 与应用程序请求的不完全相同。我忘了在最后加“/”。


小智 5

我遇到了同样的问题,我解决了如下:
我首先去了这里:(请记住在下面的 URL 中更改您的 Instagram 应用程序 IDhttps://developers.facebook.com/apps/your_instagram_app_id/instagram-basic-display/基本显示/

然后我将Client OAuth Settings,设置DeauthorizeData Deletion Requests“https://localhost:3000/”。

这对我有用。