错误
{
"error":"invalid_request",
"error_description":"redirect_uri is incorrect, check application redirect uri in the settings page"
}
settings.py
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 最佳答案
“ social_auth”通过Django构建完整的URL,它查看X_FORWARDED_FOR标头。如果您已在本地安装Nginx,则附近的配置将帮助您:
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;
}
}