-
Notifications
You must be signed in to change notification settings - Fork 172
feat: OAuth flow for VS Code #3201
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
Conversation
unfortunately, mockStates does not have "satisfies OverallState"
Pull Request Test Coverage Report for Build 15956901283Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor nits :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Pushed to stg and OAuth stil works. Tested a mission (Rune Trials) and looks good, both within and outside extension. |
Description
VSC PR: source-academy/vscode#47
To support the "Log in with NUSNET ID" option.
Unlike the SAML flow in source-academy/backend#1240, the changes needed to support this requires more code change on the frontend and none on the backend.
The OAuth 2.0 standard mandates single use for authorization codes (https://stackoverflow.com/a/26564117). Hence, we do not need to make use of the exchange table created in the earlier backend PR for SAML.
Modified login flow for VSC
User clicks any of the provider buttons on the login page within the Webview of VSC. This triggers the opening of browser window to the auth code link (NUS VAFS).
redirect_uri
=/login/vscode_callback
instead of the usual/login/callback
. (We need a way to tell frontend to act differently later on)Normal OAuth flow
Handling auth code
/login
of the backend, the frontend uses VS Code deeplink to sendcode
andclient-request-id
to the extension./login/vscode_callback
with the relevant query params. From here on, we resume the typical flow of contacting backend/login
.Type of change
How to test
Tested by pushing (a modified variant) of this branch to deploy-stg.
Checklist