Facebook login not working
I am using django 1.11 and followed the steps to enable Facebook login in my project. However, when I try to login I get the following error: Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https:// I have SSL certificate, and I can login using Google and twitter. I would be grateful if somebody can help me with this issue.
I have the same issue after Facebook updated the "Use Strict Mode to Redirect URI".
Here is the fix, add this to your settings :
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
@jackgoh, I added your code and still redirecting to http any other solution?
I've just had this issue too.
It occurs that my nginx configuration redirected from http to https but didn't forward protocol header.
I've added
proxy_set_header X-Forwarded-Proto $scheme;
to my configuration and now it works properly.
@pavelulyashev
where should i put
proxy_set_header X-Forwarded-Proto $scheme;
@slimaidarismail To use HTTPS in your website, add the following in your project's settings.py file:
# Force https redirect
SECURE_SSL_REDIRECT = True
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Force HTTPS in the final URIs
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
The HTTPS won't work if the SSL certificate isn't installed on the server. Use Let's encrypt to install SSL certificate.
There is in the documentation[1] the parameter that solves the "problem" (not a problem), I think it is important to have reference on the Facebook[2] backend page (can link this issue as well)
What opinion of you?
[1] https://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html?highlight=SOCIAL_AUTH_REDIRECT_IS_HTTPS#processing-redirects-and-urlopen [2] https://python-social-auth-docs.readthedocs.io/en/latest/backends/facebook.html
Try django sslserver https://github.com/teddziuba/django-sslserver it might help you.
Try django sslserver https://github.com/teddziuba/django-sslserver it might help you.
YES, Django SSL server can solve it. I confirmed after got the same problem. But It can help for Facebook OAuth only if use JavaScript SDK still got the same problem!!