4👍
Finally, I´ve got it working, thanks to @HenryM and very kind colleagues on irc://irc.freenode.net/django.
On this website, you can see that Facebook has different requirements depending, if your site has been created before March 2018 or after:
https://wp-native-articles.com/blog/news/how-to-fix-facebook-apps-error-cant-load-url-domain-url-isnt-included-apps-domains/
And the right setup that made my app work is this answer:
Django 2.0 allauth Facebook 2018
1) You need ssl connetion:
I’ve used django-sslserver
2) Setup a domain diferent from localhost, for example ‘development.com‘
Using Windows, add ‘127.0.0.1 development.com’ if you want your local working domain to be ‘development.com’.
3) Setup on ‘developers.facebook.com’:
Settings Basic
– App Domains: “AnySite.com”
– Privacy policy URL: “https://AnySite.com/myprivacy/“
– Website: “https://AnySite.com/“
Settings Advanced
– Server IP Whitelist: let it blank
– Domain Manager: let it blank
Facebook login Settings
-Yes Client OAuth Login
-Yes Web OAuth Login
-Yes (new: forced) Use strict Mode for redicect URLs
-Yes Embeded Browser OAuth Login
-Yes Enforce HTTPS
-Valid OAuth Redirect URLs:
“https://AnySite.com/accounts/facebook/login/callback/” (mandatory)
I hope it helps!
0👍
Facebook requires what it considers a real URL to go to so you need to give it one, for example www.development.com and then within your hosts file (I don’t know what the file is on Mac or PC but it is hosts on Linux) add the line directly below or after localhost
www.development.com 127.0.0.1
That#s what I do and it works.
0👍
I was also stuck to the same question and thanks to @ralfillo it cleared most of the thing. Here are the steps which I followed in order to complete this process.
- Install django-sslserver and add sslserver in your installed app list.
- Now if you are on Ubuntu then edit this file
/etc/hosts
and add this127.0.0.2 development.com
. Obviously you can use any other address but the domain name needs to be that. - Now go back to facebook developer page on your app settings and then you need to add App domains to
https://development.com:8000/
and at bottom website section add website url ashttps://development.com:8000/
.
Note: In Client OAuth settings only “Force Web OAuth Reauthentication ” Will be set to no else everything will be Yes. - Save those changes and go to facebook login settings page and over there add Valid OAuth Redirect URIs as
https://development.com:8000/accounts/facebook/login/callback/
. - Save those changes and then on terminal type
python manage.py runsslserver 127.0.0.2:8000
- Go to your browser and enter url as
https://development.com:8000/
and then you should be able to see your server running. Now do your facebook authentication and it will work fine.
- [Django]-How to add extra fields to django registration form?
- [Django]-How to set headers in DRF's APIClient() delete() request?
- [Django]-Using classes for Django views, is it Pythonic?
- [Django]-How to get module variable in function from another module?
- [Django]-How to use ArrayField in Django using PostgreSQL DB?