0

我正在开发一个应用程序,让用户可以看到他们自己的社交媒体数据。

我在 Django 中使用 python-social-auth,它在 twitter 和 facebook 上效果很好。

但是,我在使用 instagram 时遇到了一些麻烦。“通过 Instagram 链接授权”将用户带到以下 URL:

https://www.instagram.com/oauth/authorize?client_id=******&redirect_uri=https://example.com:8000/social-auth/complete/instagram/?redirect_state=******&state=******&response_type=code&scope=user_profile+user_media

用户单击“允许”,此时 python-social-auth 生成以下 URL 并引发异常:

https://example.com:8000/social-auth/complete/instagram/?code=******#_
social_core.exceptions.AuthCanceled: Authentication process canceled

我找到了响应对象并调用 response.text 来获得这个输出:

{"error_type": "OAuthException", "code": 400, "error_message": "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request"}'

我检查了 Instagram 基本显示设置中的重定向 uri 是否相同。https://example.com:8000/social-auth/complete/instagram/

任何建议都非常欢迎!

谢谢

劳埃德

4

0 回答 0