Loading
Draft: feat(oauth): support custom redirect URI for browser-based workspaces
Description
Problem
The OAuth flow fails in browser-based workspaces because the extension hardcodes a desktop protocol redirect URI (vscode://gitlab.gitlab-workflow/authentication) which is unavailable in browser environments.
Solution
Based on the suggestions in this comment, the extension now uses vscode.env.asExternalUri API and supports configurable OAuth parameters via environment variables:
GITLAB_WORKFLOW_OAUTH_REDIRECT_URI— overrides the defaultredirect_uriGITLAB_WORKFLOW_OAUTH_CLIENT_ID— overrides the configured OAuthclient ID
When these variables are set, the extension uses them for the OAuth flow and encodes the workspace callback URI in the OAuth state parameter, so the authorization code can be delivered back to the correct workspace.
When these environment variables are not set, the existing desktop OAuth flow (vscode:// redirect) works unchanged.
Related Issues
Resolves #700
How has this been tested?
- If
src/browserorsrc/commonhas been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE. - Consider an end-to-end test for significant new features that aren't covered by integration tests.
Screenshots (if appropriate)
What CHANGELOG entry will this MR create?
-
fix:Bug fix fixes - a user-facing issue in production - included in changelog -
feature:New feature - a user-facing change which adds functionality - included in changelog -
BREAKING CHANGE:(fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog - None - other non-user-facing changes
Edited by Roman Nikitenko