django-allauth icon indicating copy to clipboard operation
django-allauth copied to clipboard

Pattern for requesting and persisting phone number(s) via OAuth providers?

Open mecampbellsoup opened this issue 3 years ago • 1 comments

I've spent a bit of time looking through documentation, issues, and source code but haven't found clear patterns for:

  1. Requesting phone numbers to be included in user data obtained from OAuth provider(s);
  2. persisting the phone number(s) (could be more than one I assume) in our DB.

Am I missing something or is this just something that everyone has to/does figure out on demand?

mecampbellsoup avatar Feb 25 '22 15:02 mecampbellsoup

It will depend on the provider and the configuration of the provider within django-allauth, for example Facebook has a FIELDS setting within facebooks SOCIALACCOUNT_PROVIDERS configuration.

From there you can use an custom SocialAccountAdapter to override save_user which has a sociallogin parameter. The extra data sent by the provider should be located in sociallogin.account.extra_data

iarp avatar May 05 '22 14:05 iarp