Skip to content

OAuth for Gitea does not work within vs code remote #1514

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

Open
ghost opened this issue Jan 18, 2024 · 6 comments
Open

OAuth for Gitea does not work within vs code remote #1514

ghost opened this issue Jan 18, 2024 · 6 comments
Labels
auth-issue An issue authenticating to a host

Comments

@ghost
Copy link

ghost commented Jan 18, 2024

Version

latest

Operating system

Linux

OS version or distribution

Ubuntu 22.04 fresh install

Git hosting provider(s)

Other - please describe below

Other hosting provider

Gitea

(Azure DevOps only) What format is your remote URL?

None

Can you access the remote repository directly in the browser?

No, I get a permission error

Expected behavior

after installing gcm, vs code (with SSH remote plugin) shoud prompt for oauth login.

Actual behavior

OAuth for Gitea does not work within vs code SSH remote plugin
microsoft/vscode#202123 (comment)

Logs

No response

@ghost ghost added the auth-issue An issue authenticating to a host label Jan 18, 2024
@ghost ghost changed the title OAuth for Gitea does not work within vs code OAuth for Gitea does not work within vs code remote Jan 18, 2024
@dscho
Copy link
Collaborator

dscho commented Jan 20, 2024

No, I get a permission error

Maybe you want to make that a less mysterious report by sharing the actual error message?

@ghost
Copy link
Author

ghost commented Jan 22, 2024

sorry that is from the issue template.

when cloning a gitea repo, VS code prompt for user name and password like in a HTTP basic auth, instead of using git-credential-manager.

when cloing a github repo, VS code started a pop up window for the oauth as desired.

@dscho could you give me some hint about how to get a debug level log for git-credential-manager when running git clone http://....?

@dscho
Copy link
Collaborator

dscho commented Jan 22, 2024

how to get a debug level log for git-credential-manager

The common way is to set the environment variable GCM_TRACE either to 1 (in which case the debug log goes to the standard error output) or to a full path (in which case the log is written to the specified file).

@ghost
Copy link
Author

ghost commented Jan 22, 2024

sudo dpkg -i <path-to-package> git-credential-manager configure
and then in a new bash
export GCM_TRACE=1
gives me

22:24:11.284666 ...e/Application.cs:106 trace: [RunInternalAsync] Version: 2.4.1.0
22:24:11.285784 ...e/Application.cs:107 trace: [RunInternalAsync] Runtime: .NET 7.0.13
22:24:11.285816 ...e/Application.cs:108 trace: [RunInternalAsync] Platform: Linux (x86-64)
22:24:11.285823 ...e/Application.cs:109 trace: [RunInternalAsync] OSVersion: Ubuntu 22.04.3 LTS
22:24:11.285839 ...e/Application.cs:110 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
22:24:11.285900 ...e/Application.cs:111 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
22:24:11.285925 ...e/Application.cs:112 trace: [RunInternalAsync] Arguments: get
22:24:11.310428 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
22:24:11.319339 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
22:24:11.320679 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   protocol=https
22:24:11.320726 ...GitCommandBase.cs:47 trace: [ExecuteAsync]   host=gitea.example.com
22:24:11.324057 ...oviderRegistry.cs:99 trace: [GetProviderAsync] Host provider override was set id='generic'
22:24:11.325909 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Generic' was selected.
22:24:11.327541 .../HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://git.example.com account=...
22:24:11.332872 .../HostProvider.cs:131 trace: [GetCredentialAsync] No existing credentials found.
22:24:11.332888 .../HostProvider.cs:134 trace: [GetCredentialAsync] Creating new credential...
22:24:11.335289 ...ricOAuthConfig.cs:38 trace: [TryGet] Invalid OAuth configuration - missing/invalid authorize endpoint: 
22:24:11.335540 ...cHostProvider.cs:104 trace: [GenerateCredentialAsync] Skipping check for Windows Integrated Authentication on Linux.
22:24:11.335556 ...cHostProvider.cs:113 trace: [GenerateCredentialAsync] Prompting for basic credentials...
Enter basic credentials for 'https://gitea.example.com/':
Username: 22:24:11.340498 .../LinuxTerminal.cs:45 trace: [.ctor] Setting terminal echo state to 'True'

the exact repo link works on the same GCM version on windows, though

@ghost ghost changed the title OAuth for Gitea does not work within vs code remote OAuth for Gitea does not work on Linux (within vs code remote) Jan 22, 2024
@ghost ghost changed the title OAuth for Gitea does not work on Linux (within vs code remote) OAuth for Gitea does not work on Linux Jan 31, 2024
@ghost ghost changed the title OAuth for Gitea does not work on Linux OAuth for Gitea does not work within vs code remote Jan 31, 2024
@hickford
Copy link
Contributor

hickford commented Jan 31, 2024

This is expected. You can't use OAuth on a remote machine because Gitea OAuth requires a desktop web browser:

At least until Gitea implements OAuth Device Authorization Grant go-gitea/gitea#27309 (comment) (as GitHub does).

@SagePtr
Copy link

SagePtr commented Jun 24, 2024

22:24:11.335289 ...ricOAuthConfig.cs:38 trace: [TryGet] Invalid OAuth configuration - missing/invalid authorize endpoint:

This one line is not related to vscode remote, but if your git version is older than 2.41.0, it won't pass the WWW-Authenticate header to the credential helper and therefore won't autodetect Gitea. Either configure endpoints manually or update git executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-issue An issue authenticating to a host
Projects
None yet
Development

No branches or pull requests

3 participants