'Redirect URI does not match registered redirect URI' using Python Social Auth

折月煮酒 提交于 2019-12-11 03:57:03

问题


I am using python-social-auth for authentication with social networks.

I have installed and configured everything. In the last step, I added these two action links:

<a href="{% url 'social:begin' 'facebook' %}">Login with Facebook</a>
<a href="{% url 'social:begin' 'instagram' %}">Login with Instagram</a>

Facebook login is working fine but instagram is giving me the following error:

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

in my settings.py I have these:

SOCIAL_AUTH_INSTAGRAM_KEY = 'my_key'
SOCIAL_AUTH_INSTAGRAM_SECRET = 'my_secret'

and

INSTAGRAM_REDIRECT_URI = 'http://localhost:8000/shops/edit'

the most interesting part is that if I try to do this without python-social-aut, i.e. using these configurations:

INSTAGRAM_CLIENT_ID = get_env_setting('INSTAGRAM_CLIENT_ID')
INSTAGRAM_CLIENT_SECRET = get_env_setting('INSTAGRAM_CLIENT_SECRET')
INSTAGRAM_REDIRECT_URI = get_env_setting('INSTAGRAM_REDIRECT_URI')

It is just working fine.

I am thinking it has something to do with that python-social-auth app.

How can I fix it?


回答1:


Try to set SOCIAL_AUTH_INSTAGRAM_REDIRECT_URL for example

SOCIAL_AUTH_INSTAGRAM_REDIRECT_URL = 'http://localhost:8000/complete/instagram'

and check redirect uri in you instagram client settings.



来源:https://stackoverflow.com/questions/30002205/redirect-uri-does-not-match-registered-redirect-uri-using-python-social-auth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!