{
"error":"invalid_request",
"error_description":"redirect_uri is incorrect, check application redirect uri in the settings page"
}
AUTHENTICATION_BACKENDS = (
'social.backends.vk.VKOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
SOCIAL_AUTH_VK_OAUTH2_KEY = '****'
SOCIAL_AUTH_VK_OAUTH2_SECRET = '*****'
在vk.com http://127.0.0.1:8000/complete/vk-oauth2
上作为重定向URI
答案 0 :(得分:1)
“social_auth”通过Django构建完整的URL,它查看X_FORWARDED_FOR标头。如果你已在本地安装Nginx,config near将帮助你:
server {
client_max_body_size 20M;
listen 80;
server_name example.loc;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
答案 1 :(得分:0)
我看到网络请求,其中是参数redirect_uri
:
http://localhost:8000/complete/vk-oauth2/
我将其粘贴到vk.com上的重定向uri中。授权已成功结束。 要查看请求,请按f12并转到标签网络(在Firefox中)。