Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure OAuth: Github connected accounts don't fill in uid (Email) #822

Open
xtsAU opened this issue Sep 3, 2023 · 0 comments
Open

Azure OAuth: Github connected accounts don't fill in uid (Email) #822

xtsAU opened this issue Sep 3, 2023 · 0 comments

Comments

@xtsAU
Copy link

xtsAU commented Sep 3, 2023

Hi there,

I'm new on GitHub and don't actually know how to create a pull request but I found a change that fixes the issue I had with python-social-auth (in combination with the django packages) not filling in the uid field (email) when authenticating a private (individual) microsoft account that was connected to GitHub and uses the Github email.

If you do that (at least for me) a second login, or a registration from another account that uses the github email, it doesn't work since None is already used and the uid must be unique. (I use django-social-auth in combination with python-social-auth, but the fix lies in the social-core pipeline)

So i figured out the uid field would be correctly filled when changing the social-core pipeline function "social_uid" to the following:

def social_uid(backend, details, response, *args, **kwargs):
    if backend.name == 'azuread-oauth2' and details.get('email'):
        uid = details.get('email')
    else:
        uid = backend.get_user_id(details, response)
    return {'uid': uid}

Super simple, I know and something you guys probably have a deeper understanding from and can fix this at a deeper level, but that's my little contribution (if the error wasn't caused by myself somehow in the first place)

Thanks for creating and maintaining this great piece of software, though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant