Open TylerLeonhardt opened 2 years ago
@TylerLeonhardt I'm new to the callback, and don't know how the flow works. I (blindly) adopted what @bpasero did in microsoft/vscode#140329. Can you test it out? (Maybe add some steps so I get an idea how to test it myself)
It's just in source, not yet published -> use yarn link
.
If I understand this right, ideally this could go to callback.html
and no server code is needed.
There is still a little server dependency to serve callback.html
, replace some variables and set the proper content security policy. But it is true that the change I pushed for callbacks makes the flow state less, where before the server had to keep callbacks in memory (now they are in local storage of the client).
In the meantime we've adopted the new fully serverless callback.html
.
@TylerLeonhardt Is the more needed to get the auth flow running in vscode-test-web
as well?
Currently, when I try the github authentication flow, I end up with the Enter Github Auth Token
quick input.
@aeschli GitHub auth doesn't work with localhost. You will have to try either Microsoft auth or I made a test extension for UriHandlers: https://github.com/TylerLeonhardt/open-external
once you have it running locally, run the command: Open an external Uri
and choose Trigger uri handler...
In a vscode extension you can register a URI handler: https://code.visualstudio.com/api/references/vscode-api#UriHandler
This
UriHandler
will get invoked when an external webpage redirects into VS Code with the extension identifier specified.This works in vscode.dev (thanks to @joaomoreno) where the server sets up a well-known route (
vscode.dev/callback
) that handles requests that will turn around and invoke registeredUriHandler
s. Note, this works in tandem withvscode.env.openExternal
which will give you the exactUri
to redirect into.vscode-test-web
should have a similar capability and I feel like a lot of the logic can be shared.Additionally, the Microsoft and GitHub auth extensions use
UriHandler
for logging in so this means that extensions that use our in-box auth extensions can not be tested invscode-test-web
either.Workaround
Sideloading the extension on vscode.dev works around this and still allows the author to test their extension on web.