80π
Using the Django admin you need to create a SocialApp
listing your Facebook app credentials. Make sure that this app is attached to the proper site (as in, django.contrib.sites.models.Site
).
In your case, there needs to be a django.contrib.sites.models.Site
instance with id=2 (check the sites admin) that is listed as a site for the SocialApp
.
If either the SocialApp
is missing, or if it is created but not attached to a site matching your settings.SITE_ID
, then allauth
does not know what app to pick, resulting in the error message you listed above.
19π
For me, it showed this error when I had in settings.py
:
SITE_ID = 1
It worked when I changed it to 2
:
SITE_ID = 2
- [Django]-Delete multiple objects in django
- [Django]-How do I use Django groups and permissions?
- [Django]-Django model one foreign key to many tables
19π
In my case, on the Add social application page, I forgot to select my site as "Chosen sites"
π€¦πΌββοΈ
See screenshot below (on the bottom right is the Chosen Sites list):
- [Django]-Is there a way to negate a boolean returned to variable?
- [Django]-How to set up custom middleware in Django?
- [Django]-How to pull a random record using Django's ORM?
19π
Step 1: Go to your admin page.
Find social application
Step 2: now add the lines like the following image.
Give your client id and secret key given by google api and move available site (example.com)
to chosen sites
Step 3: Now go to sites
in the side navigation of admin page and customize like the following image and save it
Step 4: now, add, SITE_ID = 1
in settings.py file.
- [Django]-"Failed building wheel for psycopg2" β MacOSX using virtualenv and pip
- [Django]-Remove Labels in a Django Crispy Forms
- [Django]-How to stream an HttpResponse with Django
4π
As an alternative to putting that into the admin, you can also put it in your settings like so: (At least in 2022 with version django-allauth==0.45.0
SOCIALACCOUNT_PROVIDERS = {
'discord': {
# From https://developer.twitter.com
'APP': {
'client_id': os.environ['TWITTER_API_KEY'],
'secret': os.environ['TWITTER_API_SECRET'],
'key': os.environ['TWITTER_APP_ID'],
}
},
'twitter': {
# From https://developer.twitter.com
'APP': {
'client_id': os.environ['TWITTER_API_KEY'],
'secret': os.environ['TWITTER_API_SECRET'],
'key': os.environ['TWITTER_APP_ID'],
}
},
}
Documentation is at: https://django-allauth.readthedocs.io/en/latest/installation.html and https://django-allauth.readthedocs.io/en/latest/configuration.html
- [Django]-Get last record in a queryset
- [Django]-How to stream an HttpResponse with Django
- [Django]-Cannot import name _uuid_generate_random in heroku django
1π
It is possible that Django created an βexample.comβ site for you already (if itβs not a new project). So if this is the case you will need to delete that entry from the Sites admin page AND change the SITE_ID in settings.py to be the correct ID (probably 2 rather than 1).
Consider playing around with the SITE_ID value. For example: SITE_ID = 3, etc.
- [Django]-Django: reverse accessors for foreign keys clashing
- [Django]-How does Django Know the Order to Render Form Fields?
- [Django]-What is a NoReverseMatch error, and how do I fix it?
1π
FWIW, if configuration via the DB is giving you problems, note that you can also use configuration in settings:
SOCIALACCOUNT_PROVIDERS = {
"google": {
"APP": {
"client_id": os.environ[("GOOGLE_OAUTH_CLIENT_ID"],
"secret": os.environ[("GOOGLE_OAUTH_SECRET"],
},
},
}
@Penners
- [Django]-CharField with fixed length, how?
- [Django]-Check for pending Django migrations
- [Django]-Permission denied β nginx and uwsgi socket
0π
This worked for me
SOCIALACCOUNT_PROVIDERS = {
'google': {
'SCOPE' : [
'profile',
'email'
],
'APP': {
'client_id': os.environ['CLIENT_ID'],
'secret': os.environ['CLIENT_SECRET'],
},
'AUTH_PARAMS': {
'access_type':'online',
}
}
}
- [Django]-Default value for user ForeignKey with Django admin
- [Django]-How can I modify Procfile to run Gunicorn process in a non-standard folder on Heroku?
- [Django]-Migrating Django fixtures?