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

Catch AuthAlreadyAssociated #362

Open
mcoughlin opened this issue May 25, 2023 · 2 comments
Open

Catch AuthAlreadyAssociated #362

mcoughlin opened this issue May 25, 2023 · 2 comments

Comments

@mcoughlin
Copy link
Collaborator

Looks like we may able to catch this AuthAlreadyAssociated error (maybe comes up as people spam login). What do you think @Theodlz?

Traceback (most recent call last):
File "/skyportal_env/lib/python3.8/site-packages/tornado/web.py", line 1784, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/skyportal/baselayer/app/handlers/auth.py", line 61, in get
self._complete(backend)
File "/skyportal/baselayer/app/handlers/auth.py", line 40, in wrapper
return func(self, backend, *args, **kwargs)
File "/skyportal/baselayer/app/handlers/auth.py", line 68, in _complete
do_complete(
File "/skyportal_env/lib/python3.8/site-packages/social_core/actions.py", line 45, in do_complete
user = backend.complete(user=user, *args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/backends/base.py", line 40, in complete
return self.auth_complete(*args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/utils.py", line 247, in wrapper
return func(*args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/backends/oauth.py", line 391, in auth_complete
return self.do_auth(response['access_token'], response=response,
File "/skyportal_env/lib/python3.8/site-packages/social_core/utils.py", line 247, in wrapper
return func(*args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/backends/oauth.py", line 403, in do_auth
return self.strategy.authenticate(*args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/strategy.py", line 163, in authenticate
return backend.authenticate(*args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/backends/base.py", line 80, in authenticate
return self.pipeline(pipeline, *args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/backends/base.py", line 83, in pipeline
out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs)
File "/skyportal_env/lib/python3.8/site-packages/social_core/backends/base.py", line 113, in run_pipeline
result = func(*args, **out) or {}
File "/skyportal_env/lib/python3.8/site-packages/social_core/pipeline/social_auth.py", line 22, in social_user
raise AuthAlreadyAssociated(backend)
social_core.exceptions.AuthAlreadyAssociated: This account is already in use.

@Theodlz
Copy link
Collaborator

Theodlz commented May 25, 2023

We can for sure catch the error, give the user the uid (that we set in its cookies if I remember correctly) and return. The thing we need to make sure of, is that the user trying to log in is the right one.

@mcoughlin
Copy link
Collaborator Author

Ah yeah good point.

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