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

Reuse sign-in OAuth workflow for code host connections #17356

Closed
artemruts opened this issue Jan 18, 2021 · 5 comments
Closed

Reuse sign-in OAuth workflow for code host connections #17356

artemruts opened this issue Jan 18, 2021 · 5 comments
Assignees

Comments

@artemruts
Copy link
Contributor

artemruts commented Jan 18, 2021

Description

To reuse existing "sign-in with" OAuth workflow for code host connections, we need to have a secure way to tell the sign-in-workflow to bind given code host (user external account) to user and not with an email but with a special ID X, where X could be an opaque user ID.

Otherwise we need to require users to add their email address (of what they have in the code host) before creating code host OAuth connection. If user won't have an email address, we may end up creating a new Sourcegraph account. 🙅

Links

@github-actions
Copy link
Contributor

Heads up @tsenart - the "team/cloud" label was applied to this issue.

@artemruts artemruts changed the title Re-use sign-in OAuth workflow for code host connections Reuse sign-in OAuth workflow for code host connections Jan 18, 2021
@ryanslade ryanslade self-assigned this Jan 19, 2021
@ryanslade ryanslade added this to the Cloud 2021-01-13 milestone Jan 19, 2021
@ryanslade
Copy link
Contributor

It appears that we already support this workflow. If we attempt to "sign in with codehost" after a user is already authenticated then we'll link the external account with the currently logged in user.

I've tested this locally in the following way:

  1. Sign in to Sourcegraph with a new user with an email that doesn’t match any in GitHub (using the + trick for gmail)
  2. Temporarily disable the redirect here so that can “continue with GitHub”.
  3. Navigate to /sign-inand click on continue with GitHub
  4. It successfully links the GitHub account with the existing logged in user and creats a new entry in the user_external_accounts table.

@ryanslade
Copy link
Contributor

@artemruts Did you confirm that the above works, can we close this?

@artemruts
Copy link
Contributor Author

@ryanslade I'll close this after code goes through QA, I believe it works :)
Will re-assign to myself.

@artemruts artemruts assigned artemruts and unassigned ryanslade Jan 26, 2021
@tsenart
Copy link
Contributor

tsenart commented Feb 5, 2021

@artemruts: Can we get a demo video to share in #progress?

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

3 participants