Recently integrated GitHub authentication in my Django website and noticed that Python Social Auth is registering the users using a non-primary email address.
How can that behaviour be modified?
Recently integrated GitHub authentication in my Django website and noticed that Python Social Auth is registering the users using a non-primary email address.
How can that behaviour be modified?
Copyright © 2021 Jogjafile Inc.
By design, authentication with GitHub uses the email that GitHub returns after authentication. As noted by Alexander,
Based on the next image, you can see that in my case it'll return
[email protected]. Check yours here.So, you can settle that the email used is the public one and not the primary.
If you still want to use the primary email, you'll need change the pipeline. Start by getting the list email addresses for the authenticated user. You'll get something like this
Then, adjust the user creation to use the primary email instead.