问题
I'm attempting to install and configure Django AllAuth and I've run into a plethora of obstacles. Im afraid I'm simply missing a few basic concepts which might clear some things up.
1) In order to get basic social authentication working what setup needs to be done inside the social provider (facebook, twitter, etc..)
2) If this is the case then how would one develop locally because at first glance of twitter's API setup it asks for redirect URLs which would get hairy considering everything right now is hosted locally.
3) When I try and go to /accounts/login/
it redirects to /accounts/profile/
every time. Can't seem to figure out what's causing this redirect.
4) I was previously using Userena for my user authentication and was going to add django-social-auth but when I got into it that was giving me difficulty. I then found AllAuth which seemed to fit my needs perfectly but again, having some issues. Can anyone weigh in on this decision, would you recommend one over the other and if so why? Thanks for your help.
UPDATE: Facebook Error: "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."
When I click okay it redirects back to my site. My browser gives me a security error and when I proceed through that I end up back at my site displaying: "Social Network Login Failure An error occurred while attempting to login via your social network account."
回答1:
1) Have a look here: https://speakerdeck.com/tedtieken/signing-up-and-signing-in-users-in-django-with-django-allauth
(specifically, slide 61 and above)
2) Simply use 127.0.0.1:8000 in your redirect URLs
3) By default allauth redirects to LOGIN_REDIRECT_URL
, which is set out of the box to /accounts/profile/: https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
4) As I am the author of allauth I will skip answering this question myself. Browse through the complete presentation referred to by 1) -- the initial slides provide a good comparison of the various options.
来源:https://stackoverflow.com/questions/16951205/django-allauth-installation