Have Loopback Server flow redirect back to VS Code and make it the primary flow (#251333)

* Have Loopback Server flow redirect back to VS Code and make it the primary flow

Fixes https://github.com/microsoft/vscode/issues/250086

* Fix test

* Fix test

* Fix other test
This commit is contained in:
Tyler James Leonhardt
2025-06-12 23:14:41 -07:00
committed by GitHub
parent 7766411d9f
commit 31620a3dec
5 changed files with 358 additions and 345 deletions

View File

@@ -82,7 +82,7 @@ export class LoopbackAuthServer implements ILoopbackServer {
return this._startingRedirect.searchParams.get('state') ?? undefined;
}
constructor(serveRoot: string, startingRedirect: string) {
constructor(serveRoot: string, startingRedirect: string, callbackUri: string) {
if (!serveRoot) {
throw new Error('serveRoot must be defined');
}
@@ -126,7 +126,7 @@ export class LoopbackAuthServer implements ILoopbackServer {
throw new Error('Nonce does not match.');
}
deferred.resolve({ code, state });
res.writeHead(302, { location: '/' });
res.writeHead(302, { location: `/?redirect_uri=${encodeURIComponent(callbackUri)}` });
res.end();
break;
}