问题
I'm using django-allauth for Facebook authentication in developement for a site and have set up accordingly:
within the facebook app settings on facebok:
Namespace: test_login
App Domains: blank
Site URL: http://127.0.0.1:8000/
Canvas URL: http://127.0.0.1:8000/
Secure Canvas URL: https://127.0.0.1:8000/
in Django admin I created new Social app:
Provider: Facebook
name: test_login
client_id: xxx
Secret: xxx
Sites: http://127.0.0.1:8000/
as you can see I added a new site http://127.0.0.1:8000/
instead of example.com
.
The SITE_ID in the settings.py is the correct one.
So everything should be working, but it's not. After clicking to login through Facebook I get
Given URL is not allowed by the Application configuration.:
One or more of the given URLs is not allowed by the App's settings.
It must match the Website URL or Canvas URL, or the domain must be a
subdomain of one of the App's domains.
What am I missing? What isn't configured? As far as I can understand I should be able to use 127.0.0.1:8000
for testing.
回答1:
It worked for me setting the url in Facebook as localhost
instead of 127.0.0.1. Also pass localhost:8000
to ./manage.py runserver
回答2:
I had the same problem an hour ago. I've fixed it by setting the Site URL
and Valid OAuth redirect URIs
to http://fuf.me:8080
. fuf.me point to 127.0.0.1, so your localhost, and also I've changed the default 8000 port to 8080. You can do this by running python manage.py runserver localhost:8080
Also I've enabled Browser OAuthLogin and WebOauthLogin.
来源:https://stackoverflow.com/questions/16524499/django-allauth-facebook-local-development