Skip to content

OAuth-Based Gitlab Integration to a Self-Hosted Instance Doesn't Work #134

@Kenneth-Sills

Description

@Kenneth-Sills

Pricore Version

0.52.4

PHP Version

Provided by ghcr.io/pricorephp/pricore:0.52.4

Description

On a self-hosted Pricore deployment pointed at a self-hosted GitLab instance, a user who connects GitLab via OAuth has no path to point the resulting Git Credential at their GitLab base URL. The credential's edit form gates the GitLab URL field behind the personal-access-token field above it, which is marked required. Because the OAuth flow never captures a base URL, and the URL field can't be saved without also providing a PAT, all GitLab API calls fall through to the hardcoded https://gitlab.com default in GitLabProvider::getBaseUrl() and 401 against the user's self-hosted-issued OAuth token.

This effectively blocks the self-hosted-Pricore-against-self-hosted-GitLab deployment shape unless the user generates and pastes a PAT they shouldn't otherwise need.

Steps to Reproduce

  1. Deploy Pricore (ghcr.io/pricorephp/pricore:latest) against a self-hosted GitLab instance (e.g. https://gitlab.example.com).
  2. Sign in to Pricore and connect GitLab via OAuth from the user-account integration flow.
  3. Navigate to Settings → Git Credentials and click Edit on the GitLab credential created in step 2.
  4. Enter https://gitlab.example.com in the GitLab URL field and try to save without filling in the PAT field above it.
  5. Observe that the save is blocked because the PAT field is required.
  6. Skip the save, navigate to the import-repository flow, and trigger a "list available repositories" call.

Expected Behavior

I would expect that using the OAuth-integration would capture the Gitlab base URL during the creation flow or honor the site-wide GITLAB_INSTANCE_URI used to direct the OAuth flow, requiring no customization.

Actual Behavior

With no URL on the credential, GitLabProvider::getBaseUrl() falls through to the hardcoded default of https://gitlab.com, causing all subsequent API calls to that integration provider to fail.

Additional Context

I plan on submitting a fix MR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions