Login via OAuth fails
Checklist
-
I'm using the latest version of the extension (Run glab --version
)- Extension version: 1.32.0
-
Operating system and version: Windows 11 w/ Docker Desktop running Ubuntu 22.04.2 in WSL2 -
Gitlab.com or self-managed instance? gitlab.com -
I have performed glab auth status
to check for authentication issues
Summary
Running and completing the steps with the command glab auth login
results in completion with an error at the end: error using api: GET https://gitlab.com/api/v4/user: 401 {message: 401 Unauthorized}
Steps to reproduce
- Run
glab auth login
? What GitLab instance do you want to log into? gitlab.com
? How would you like to login? Web
- Open the link manually with a ctrl+click in the terminal (as it fails to auto-launch in the browser)
- Authorise the application on the page on gitlab.com
? Choose default git protocol HTTPS
? Authenticate Git with your GitLab credentials? Yes
What is the current bug behavior?
The process ends with the message error using api: GET https://gitlab.com/api/v4/user: 401 {message: 401 Unauthorized}
.
❯ glab auth status
gitlab.com
x gitlab.com: api call failed: GET https://gitlab.com/api/v4/user: 401 {message: 401 Unauthorized}
✓ Git operations for gitlab.com configured to use https protocol.
✓ API calls for gitlab.com are made over https protocol
✓ REST API Endpoint: https://gitlab.com/api/v4/
✓ GraphQL Endpoint: https://gitlab.com/api/graphql/
x No token provided
What is the expected correct behavior?
A successful authentication.
Relevant logs and/or screenshots
❯ glab auth login
? What GitLab instance do you want to log into? gitlab.com
- Logging into gitlab.com
? How would you like to login? Web
Failed opening a browser at https://gitlab.com/oauth/authorize?client_id=41d48f9422ebd655dd9cf2947d6979681dfaddc6d0c56f7628f6ada59559af1e&redirect_uri=http://localhost:7171/auth/redirect&response_type=code&state=Aq6AtfKARO6vu7fFCccvOMCk44RSpWSGJzX2GtHqCQxcm&scope=openid profile read_user write_repository api&code_challenge=x8aUCKcuOao0IgHUhgqKd-e9ASjebvFJ2Zmf--6r5zs&code_challenge_method=S256
Encountered error: exec: "xdg-open": executable file not found in $PATH
Please try entering the URL in your browser manually
? Choose default git protocol HTTPS
? Authenticate Git with your GitLab credentials? Yes
- glab config set -h gitlab.com git_protocol https
✓ Configured git protocol
- glab config set -h gitlab.com api_protocol https
✓ Configured API protocol
error using api: GET https://gitlab.com/api/v4/user: 401 {message: 401 Unauthorized}
❯ glab auth status
gitlab.com
x gitlab.com: api call failed: GET https://gitlab.com/api/v4/user: 401 {message: 401 Unauthorized}
✓ Git operations for gitlab.com configured to use https protocol.
✓ API calls for gitlab.com are made over https protocol
✓ REST API Endpoint: https://gitlab.com/api/v4/
✓ GraphQL Endpoint: https://gitlab.com/api/graphql/
x No token provided