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 =" ?
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
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...
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mark Sapiro writes:
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.
Yeah, but then I (@yasegumi@twitter) could log in as yasegumi@example.com and every other yasegumi in the world. There probably aren't any of those that aren't me, but of the 30 kids in my 6th grade class 5 were named something with the diminuative "Steve", and we also had one Stephanie. So I could log in as steve@turnbull.sk.tsukuba.ac.jp (that's me) or steve@xemacs.org (that's not me, I'm stephen@xemacs.org), or steve@any.old.com. Not good.
Also, I wouldn't trust Musk's Twitter with no security staff left to give out only confirmed email addresses. If they give out any address you gave them, then anybody can spoof anybody. So I would advise not using Twitter as an idP under any conditions, unless it's to prove you own a Twitter handle.
Steve
On Tue, Dec 27, 2022 at 11:57 AM Stephen J. Turnbull < stephenjturnbull@gmail.com> wrote:
Mark Sapiro writes:
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.
Yeah, but then I (@yasegumi@twitter) could log in as yasegumi@example.com and every other yasegumi in the world. There probably aren't any of those that aren't me, but of the 30 kids in my 6th grade class 5 were named something with the diminuative "Steve", and we also had one Stephanie. So I could log in as steve@turnbull.sk.tsukuba.ac.jp (that's me) or steve@xemacs.org (that's not me, I'm stephen@xemacs.org), or steve@any.old.com. Not good.
Also, I wouldn't trust Musk's Twitter with no security staff left to give out only confirmed email addresses. If they give out any address you gave them, then anybody can spoof anybody. So I would advise not using Twitter as an idP under any conditions, unless it's to prove you own a Twitter handle.
Okay. Now I really don't want to add Twitter to my Social Account logins :-)
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
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 '^$|^.*#' ¯\_(ツ)_/¯ :-)
On 12/27/22 01:35, Odhiambo Washington wrote:
- Lastly, I needed to add the relevant options under the SOCIALACCOUNT_PROVIDERS = in settings.py.
Now I have this: ... And those are working but was wondering what to add for Twitter.
I see from another post that you've decided against using Twitter, but to answer the question, Twitter does not require adding anything to SOCIALACCOUNT_PROVIDERS.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Tue, Dec 27, 2022 at 8:08 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/27/22 01:35, Odhiambo Washington wrote:
- Lastly, I needed to add the relevant options under the SOCIALACCOUNT_PROVIDERS = in settings.py.
Now I have this: ... And those are working but was wondering what to add for Twitter.
I see from another post that you've decided against using Twitter, but to answer the question, Twitter does not require adding anything to SOCIALACCOUNT_PROVIDERS.
I tried it and ended up with:
ERROR 2022-12-28 08:40:18,895 97440 django.request Internal Server Error: /accounts/twitter/login/ Traceback (most recent call last): File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth/views.py", line 43, in view return self.dispatch(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/base/mixins.py", line 18, in dispatch return self.login(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth/views.py", line 75, in login client = self._get_client(request, callback_url) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth/views.py", line 49, in _get_client app = provider.get_app(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/base/provider.py", line 30, in get_app return adapter.get_app(request, self.id) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 204, in get_app app = SocialApp.objects.get_current(provider, request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 31, in get_current app = self.get(sites__id=site.id, provider=provider) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/db/models/query.py", line 650, in get raise self.model.DoesNotExist( allauth.socialaccount.models.SocialApp.DoesNotExist: SocialApp matching query does not exist.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
On 12/27/22 21:46, Odhiambo Washington wrote:
On Tue, Dec 27, 2022 at 8:08 PM Mark Sapiro <mark@msapiro.net> wrote:
I see from another post that you've decided against using Twitter, but to answer the question, Twitter does not require adding anything to SOCIALACCOUNT_PROVIDERS.
I tried it and ended up with:
ERROR 2022-12-28 08:40:18,895 97440 django.request Internal Server Error: /accounts/twitter/login/ Traceback (most recent call last): ... allauth.socialaccount.models.SocialApp.DoesNotExist: SocialApp matching query does not exist.
Do you have
'allauth.socialaccount.providers.twitter',
in INSTALLED_APPS?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Wed, Dec 28, 2022 at 8:23 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/27/22 21:46, Odhiambo Washington wrote:
On Tue, Dec 27, 2022 at 8:08 PM Mark Sapiro <mark@msapiro.net> wrote:
I see from another post that you've decided against using Twitter, but to answer the question, Twitter does not require adding anything to SOCIALACCOUNT_PROVIDERS.
I tried it and ended up with:
ERROR 2022-12-28 08:40:18,895 97440 django.request Internal Server Error: /accounts/twitter/login/ Traceback (most recent call last): ... allauth.socialaccount.models.SocialApp.DoesNotExist: SocialApp matching query does not exist.
Do you have
'allauth.socialaccount.providers.twitter',
in INSTALLED_APPS?
Here is what I have in settings_local.py:
INSTALLED_APPS = ( 'hyperkitty', 'postorius', 'django_mailman3', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_gravatar', 'compressor', 'haystack', 'django_extensions', 'django_q', 'allauth', 'allauth.account', 'allauth.socialaccount', #'django_mailman3.lib.auth.fedora', #'allauth.socialaccount.providers.openid', 'allauth.socialaccount.providers.github', #'allauth.socialaccount.providers.gitlab', 'allauth.socialaccount.providers.google', 'allauth.socialaccount.providers.facebook', 'allauth.socialaccount.providers.twitter', #'allauth.socialaccount.providers.stackexchange', )
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
On 12/28/22 11:37, Odhiambo Washington wrote:
On Wed, Dec 28, 2022 at 8:23 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/27/22 21:46, Odhiambo Washington wrote:
On Tue, Dec 27, 2022 at 8:08 PM Mark Sapiro <mark@msapiro.net> wrote:
I see from another post that you've decided against using Twitter, but to answer the question, Twitter does not require adding anything to SOCIALACCOUNT_PROVIDERS.
I tried it and ended up with:
ERROR 2022-12-28 08:40:18,895 97440 django.request Internal Server Error: /accounts/twitter/login/ Traceback (most recent call last): ... allauth.socialaccount.models.SocialApp.DoesNotExist: SocialApp matching query does not exist.
Do you have
'allauth.socialaccount.providers.twitter',
in INSTALLED_APPS?
Here is what I have in settings_local.py:
INSTALLED_APPS = ( 'hyperkitty', 'postorius', 'django_mailman3', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_gravatar', 'compressor', 'haystack', 'django_extensions', 'django_q', 'allauth', 'allauth.account', 'allauth.socialaccount', #'django_mailman3.lib.auth.fedora', #'allauth.socialaccount.providers.openid', 'allauth.socialaccount.providers.github', #'allauth.socialaccount.providers.gitlab', 'allauth.socialaccount.providers.google', 'allauth.socialaccount.providers.facebook', 'allauth.socialaccount.providers.twitter', #'allauth.socialaccount.providers.stackexchange', )
Did you add an app at https://site.name/admin/socialaccount/socialapp/ with twitter as a provider? See https://django-allauth.readthedocs.io/en/latest/providers.html#twitter-oauth...
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Thu, Dec 29, 2022 at 3:44 AM Mark Sapiro <mark@msapiro.net> wrote:
On 12/28/22 11:37, Odhiambo Washington wrote:
On Wed, Dec 28, 2022 at 8:23 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/27/22 21:46, Odhiambo Washington wrote:
On Tue, Dec 27, 2022 at 8:08 PM Mark Sapiro <mark@msapiro.net> wrote:
I see from another post that you've decided against using Twitter, but to answer the question, Twitter does not require adding anything to SOCIALACCOUNT_PROVIDERS.
I tried it and ended up with:
ERROR 2022-12-28 08:40:18,895 97440 django.request Internal Server Error: /accounts/twitter/login/ Traceback (most recent call last): ... allauth.socialaccount.models.SocialApp.DoesNotExist: SocialApp matching query does not exist.
Do you have
'allauth.socialaccount.providers.twitter',
in INSTALLED_APPS?
Here is what I have in settings_local.py:
INSTALLED_APPS = ( 'hyperkitty', 'postorius', 'django_mailman3', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_gravatar', 'compressor', 'haystack', 'django_extensions', 'django_q', 'allauth', 'allauth.account', 'allauth.socialaccount', #'django_mailman3.lib.auth.fedora', #'allauth.socialaccount.providers.openid', 'allauth.socialaccount.providers.github', #'allauth.socialaccount.providers.gitlab', 'allauth.socialaccount.providers.google', 'allauth.socialaccount.providers.facebook', 'allauth.socialaccount.providers.twitter', #'allauth.socialaccount.providers.stackexchange', )
Did you add an app at https://site.name/admin/socialaccount/socialapp/ with twitter as a provider? See
https://django-allauth.readthedocs.io/en/latest/providers.html#twitter-oauth...
Exactly, and I have entered all the credentials from the "OAuth 2.0 Client ID and Client Secret" of the twitter developer portal.
https://webmail.kictanet.or.ke/~wash/twitter-oauth.png
I have checked my settings_local.py several times trying to find out why the entry is ignored.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
On 12/29/22 00:31, Odhiambo Washington wrote:
Exactly, and I have entered all the credentials from the "OAuth 2.0 Client ID and Client Secret" of the twitter developer portal.
Try adding lists.kictanet.or.ke to Chosen sites along with mm3-lists.kictanet.or.ke
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Thu, Dec 29, 2022 at 10:08 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/29/22 00:31, Odhiambo Washington wrote:
Exactly, and I have entered all the credentials from the "OAuth 2.0
Client
ID and Client Secret" of the twitter developer portal.
Try adding lists.kictanet.or.ke to Chosen sites along with mm3-lists.kictanet.or.ke
Even with that added, still same error.
ERROR 2022-12-29 15:26:40,224 70236 django.request Internal Server Error: /accounts/twitter/login/ Traceback (most recent call last): File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth/views.py", line 43, in view return self.dispatch(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/base/mixins.py", line 18, in dispatch return self.login(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth/views.py", line 75, in login client = self._get_client(request, callback_url) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth/views.py", line 49, in _get_client app = provider.get_app(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/providers/base/provider.py", line 30, in get_app return adapter.get_app(request, self.id) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 204, in get_app app = SocialApp.objects.get_current(provider, request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 31, in get_current app = self.get(sites__id=site.id, provider=provider) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/db/models/query.py", line 650, in get raise self.model.DoesNotExist( allauth.socialaccount.models.SocialApp.DoesNotExist: SocialApp matching query does not exist.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
On 12/30/22 03:12, Odhiambo Washington wrote:
On Thu, Dec 29, 2022 at 10:08 PM Mark Sapiro <mark@msapiro.net> wrote:
Try adding lists.kictanet.or.ke to Chosen sites along with mm3-lists.kictanet.or.ke
Even with that added, still same error.
Did you run django-admin migrate
after uncommenting
'allauth.socialaccount.providers.twitter', in your settings?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Fri, Dec 30, 2022 at 7:51 PM Mark Sapiro <mark@msapiro.net> wrote:
On 12/30/22 03:12, Odhiambo Washington wrote:
On Thu, Dec 29, 2022 at 10:08 PM Mark Sapiro <mark@msapiro.net> wrote:
Try adding lists.kictanet.or.ke to Chosen sites along with mm3-lists.kictanet.or.ke
Even with that added, still same error.
Did you run
django-admin migrate
after uncommenting 'allauth.socialaccount.providers.twitter', in your settings?
I always do whenever I change anything in settings.
(venv) [mailman@gw ~/mm]$ /opt/mailman/mm/bin/django-admin migrate Operations to perform: Apply all migrations: account, admin, auth, contenttypes, django_mailman3, django_q, hyperkitty, postorius, sessions, sites, socialaccount Running migrations: No migrations to apply. (venv) [mailman@gw ~/mm]$
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
On 12/30/22 23:40, Odhiambo Washington wrote:
On Fri, Dec 30, 2022 at 7:51 PM Mark Sapiro <mark@msapiro.net> wrote:
Did you run
django-admin migrate
after uncommenting 'allauth.socialaccount.providers.twitter', in your settings?I always do whenever I change anything in settings.
I'm out of ideas.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (3)
-
Mark Sapiro
-
Odhiambo Washington
-
Stephen J. Turnbull