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

Handling AuthAlreadyAssociated #226

Closed
hroncok opened this issue Mar 23, 2014 · 5 comments
Closed

Handling AuthAlreadyAssociated #226

hroncok opened this issue Mar 23, 2014 · 5 comments

Comments

@hroncok
Copy link

hroncok commented Mar 23, 2014

Hi,
imagine a following situation:

  • 2 auth methods are supported (let's say fedora and github)
  • user walks in for the first time, authorize with one (fedora)
  • user doesn't pair the account with the second (github)
  • user logs out
  • user walks in for the second time, authorize with second (github)
  • now 2 accounts are there for him, one for each authorisation

How does the user join the two? Cause when the user tries to pair the account with the first auth method (fedora), the site gives 500 and the following is in the logs:

AuthAlreadyAssociated: This fedora account is already in use.

So the real questions are:

  • Is it even possible to join two accounts like this
  • If not, how can I catch this exception and at least tell the user something to comport him instead of throwing 500 at him?

Thanks in advance

@hroncok
Copy link
Author

hroncok commented Mar 23, 2014

Do I need to use social.pipeline.social_auth.associate_by_email? And what of the emails are different?

@omab
Copy link
Owner

omab commented Mar 23, 2014

associate_by_email with associate accounts with the same email address, so if they are different that won't work. Account merging is tricky and python-social-auth won't support it usually is project dependent, there's a lot to take into account like what happens any data that the user could be generated with both accounts, etc.

The exception can be catched by adding this middleware, you can easily extend it to add your behavior, like merging accounts or tell the user to get in touch with some support team, etc. There's some doc about the middleware here http://psa.matiasaguirre.net/docs/configuration/django.html#exceptions-middleware.

@omab omab closed this as completed Mar 24, 2014
@hroncok
Copy link
Author

hroncok commented Mar 24, 2014

Thanks a lot for answering my noob questions.

@omab
Copy link
Owner

omab commented Mar 24, 2014

@hroncok, the mailing list or IRC channel is a better place to put questions and answer them.

@hroncok
Copy link
Author

hroncok commented Mar 24, 2014

Thanks for info, will ask for help there next time.

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