On Mon, Dec 26, 2022 at 7:33 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/26/22 06:14, Odhiambo Washington wrote:
I'd like to integrate Twitter OAuth as part of the Social Accounts in my setup. I have gone through https://django-allauth.readthedocs.io/en/latest/providers.html#twitter, but cannot find the config options to add to my settings. Does someone have a config block setting for "SOCIALACCOUNT_PROVIDERS =" ?
The last I looked into using Twitter as an OAuth2 provider, which was some time ago, it would not work because Twitter would not provide the user's email address via OAuth2. Possibly this could work if the user's name was her Twitter handle.
As far as SOCIALACCOUNT_PROVIDERS is concerned, you don't need anything. You just need to create your OAuth2 app and provide the keys via the Django admin SOCIAL ACCOUNTS interface. See
https://django-allauth.readthedocs.io/en/latest/providers.html#twitter-oauth...
What I did:
- I had to uncomment the relevant line under the INSTALLED_APPS = in settings.py. I had to restart Apache so that I can get the relevant provider name at https://mysite.name/admin/socialaccount/socialapp/
- I would then configure the social app as per https://django-allauth.readthedocs.io/en/latest/providers.html
- Lastly, I needed to add the relevant options under the SOCIALACCOUNT_PROVIDERS = in settings.py.
Now I have this:
SOCIALACCOUNT_PROVIDERS = { 'google': { 'SCOPE': ['profile', 'email'], 'AUTH_PARAMS': {'access_type': 'online'}, }, 'github': { 'SCOPE': [ 'user', 'repo', 'read:org', ], }, 'facebook': { 'METHOD': 'oauth2', 'SCOPE': ['email'], 'FIELDS': [ 'email', 'name', 'first_name', 'last_name', 'locale', 'timezone', ], 'VERSION': 'v15.0', }, }
And those are working but was wondering what to add for Twitter.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)