Skip to content

GitLab OAuth flow failed with 401

Created by: eseliger

When connecting to my GitLab.com account using the new OAuth flow from the user code host connection page, I encountered a 401 error after the redirect from gitlab.com to our site. This is the error message:

unable to get GitLab user: unexpected response from GitLab API (https://gitlab.com/api/v4/user): HTTP error status 401

Not sure if it's relevant or not, I was initially not logged in to gitlab when I was redirected to gitlab.com, then signed in using their OAuth connection to GitHub, was presented a modal that Sourcegraph Cloud would like to get access, I confirmed and was redirected to the callback URL which returned the above error.

DM me if you like to get the full URL of the redirect, as it contains an access token.