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

get() returned more than one UserSocialAuth -- it returned 2! #553

Closed
ghost opened this issue Mar 18, 2015 · 4 comments
Closed

get() returned more than one UserSocialAuth -- it returned 2! #553

ghost opened this issue Mar 18, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 18, 2015

I'm trying to implement Steam login into my project, and I get the error get() returned more than one UserSocialAuth -- it returned 2! when I try to do user.social_auth.get(provider='steam'). This seems to happen when someone has the same username—the rows in social_auth_usersocialauth are associated to the same auth.User. Attached an image to show what I mean:
screen shot 2015-03-18 at 8 01 37 pm

As a side note, is it a good idea to store the Steam name as username field in auth.User? Steam names can be changed and are not unique. I think it's better to just return something unique for the username field, like UID.

@ghost
Copy link
Author

ghost commented Mar 20, 2015

Anyone?

@omab
Copy link
Owner

omab commented Apr 4, 2015

The steam username is used as a base to the user username, if it's duplicated, then a extra hash will be added (so they are never repeated), also, if the user changes his username in steam, it won't change the username in your site (username is defined only once).

You are getting that error because you have two steam accounts associated to a single user, python-social-auth doesn't put any constraint to that, you can have several accounts from the same provider associated to a given user.

You should do user.social_auth.filter(provider='steam')[0] (or select one of them).

@omab omab closed this as completed Apr 4, 2015
@ghost
Copy link
Author

ghost commented Apr 5, 2015

if it's duplicated, then a extra hash will be added (so they are never repeated)

That's the problem here, it doesn't seem to add an extra hash when there are collisions. I logged in using two different Steam accounts with the same username then this happened.

Anyway, I solved the problem by writing a custom pipeline to replace usernames with Steam UIDs, it's good enough for my requirements.

Thanks!

@boxconnect
Copy link

Has this been solved? I am facing the same issue. @CrimsonRay: Could you provide your pipeline code?

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

No branches or pull requests

2 participants