Skip to content

GCM Browser Oauth Authentication for Gitlab not redirecting based on context path #807

Open
@abhikum1

Description

@abhikum1

Which version of GCM are you using?
2.0.785+6074e4e3d3

Which Git host provider are you trying to connect to?

  • Azure DevOps
  • Azure DevOps Server (TFS/on-prem)
  • GitHub
  • GitHub Enterprise
  • Bitbucket
  • [ X] Other - Gitlab

Can you access the remote repository directly in the browser using the remote URL?

From a terminal, run git remote -v to see your remote URL.

  • Yes
  • No, I get a permission error
  • [X ] No, for a different reason - please describe

Using GCM to authenticate to gitlab using browser authentication. However our local deployment of Gitlab instance using a context path.
Example of our URL : https://mygitlabserverhostname/git
Note: Hostname is masked.
Steps to reproduce:
Step 1: Setup Gitlab in GCM using the context path /git
My Git Config Setting
[credential "https://mygitlabserverhostname/git"] GitLabDevClientId = someclientid GitLabDevClientSecret = someclientsecret gitLabAuthModes = browser usehttppath = true provider = gitlab
Step 2: Run git clone to a repository with GCM Trace = 1
Output of the commands
11:13:20.464235 ...\Application.cs:95 trace: [RunInternalAsync] Version: 2.0.785.29792 11:13:20.464235 ...\Application.cs:96 trace: [RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000 11:13:20.464235 ...\Application.cs:97 trace: [RunInternalAsync] Platform: Windows (x86-64) 11:13:20.464235 ...\Application.cs:98 trace: [RunInternalAsync] OSVersion: 10.0 (build 19044) 11:13:20.464235 ...\Application.cs:99 trace: [RunInternalAsync] AppPath: C:\Program Files (x86)\Git Credential Manager\git-credential-manager-core.exe 11:13:20.464235 ...\Application.cs:100 trace: [RunInternalAsync] Arguments: get 11:13:20.511908 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command... 11:13:20.527547 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input: 11:13:20.527547 ...GitCommandBase.cs:48 trace: [ExecuteAsync] protocol=https 11:13:20.527547 ...GitCommandBase.cs:48 trace: [ExecuteAsync] host=mygitlabhostname 11:13:20.527547 ...GitCommandBase.cs:48 trace: [ExecuteAsync] path=git/TEST/uats/glal_validation/glal_demos/demo_sources.git 11:13:20.579990 ...oviderRegistry.cs:99 trace: [GetProviderAsync] Host provider override was set id='gitlab' 11:13:20.579990 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitLab' was selected. 11:13:20.830380 ...bHostProvider.cs:127 trace: [GetSupportedAuthenticationModes] Supported authentication modes override present: Browser 11:13:21.011802 ...enticationBase.cs:40 trace: [InvokeHelperAsync] Starting helper process: C:\Program Files (x86)\Git Credential Manager\GitLab.UI.exe prompt --url https://myserverhostname/git/TEST/uats/glal_validation/glal_demos/demo_sources.git --browser


Expected behavior

  1. Popup should be displayed to sign in with gitlab browser
  2. On Clicking Sign in web browser should open to authroize the application with URL
    https://mygitlabserverhostname/git/oauth/authorize?response_type=code&client_id=7cf4327cdefbc06637dffff4e....

Actual behavior

  1. Popup is displayed -> Clicked Sign in
  2. the default browser opens with URL:
    https://mygitlabserverhostname/oauth/authorize?response_type=code&client_id=7cf4327cdefbc06637dffff4e....
    However if you notice the /git is missing hence giving an error in the browser.

If i manually change the url in the browser to https://mygitlabserverhostname/git/oauth/authorize?response_type=code&client_id=7cf4327cdefbc06637dffff4e....
the Oauth authroize page opens.

Logs

Set the environment variables GCM_TRACE=1 and GIT_TRACE=1 and re-run your Git command. Review and redact any private information and attach the log.

If you are running inside of Windows Subsystem for Linux (WSL), you must also set an additional environment variable to enable tracing: WSLENV=$WSLENV:GCM_TRACE.
For example:

WSLENV=$WSLENV:GCM_TRACE:GIT_TRACE GCM_TRACE=1 GIT_TRACE=1 git fetch

Metadata

Metadata

Assignees

Labels

auth-issueAn issue authenticating to a hostbugA bug in Git Credential Manager

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions