gitlabhq/gitlabhq · error · Import::GithubOauth::OAuthConfigMissingError

Missing OAuth configuration for GitHub.

Error message

Missing OAuth configuration for GitHub.

What it means

The GitHub import OAuth concern's oauth_client method raises OAuthConfigMissingError unless an oauth_config exists - i.e. the instance's gitlab.yml / omniauth configuration has no 'github' provider section with app_id and app_secret. The import flow cannot build an OAuth2::Client without it.

Source

Thrown at app/controllers/concerns/import/github_oauth.rb:30

    private

    def provider_auth
      return if session[access_token_key].present?

      go_to_provider_for_permissions unless ci_cd_only?
    end

    def ci_cd_only?
      %w[1 true].include?(params[:ci_cd_only])
    end

    def go_to_provider_for_permissions
      redirect_to authorize_url
    end

    def oauth_client
      raise OAuthConfigMissingError unless oauth_config

      oauth_client_from_config
    end

    def oauth_client_from_config
      @oauth_client_from_config ||= ::OAuth2::Client.new(
        oauth_config.app_id,
        oauth_config.app_secret,
        oauth_options.merge(ssl: { verify: oauth_config['verify_ssl'] })
      )
    end

    def oauth_config
      @oauth_config ||= Gitlab::Auth::OAuth::Provider.config_for('github')
    end

    def oauth_options
      return unless oauth_config

View on GitHub (pinned to 55ee20384a)

Solutions

  1. Omnibus: add a github entry under gitlab_rails['omniauth_providers'] with app_id/app_secret from github.com/settings/developers, then gitlab-ctl reconfigure
  2. GDK/source: fill in the providers: github: section in config/gitlab.yml and restart
  3. Restart GitLab after changing configuration so the YAML is reloaded
  4. Alternative: import with a GitHub personal access token instead of OAuth (the ci_cd_only / token-based flow does not need the OAuth client)

Example fix

# gitlab.yml (before)
production: &base
  omniauth:
    enabled: true
    providers: []

# gitlab.yml (after)
production: &base
  omniauth:
    enabled: true
    providers:
      - { name: 'github', app_id: 'YOUR_CLIENT_ID',
          app_secret: 'YOUR_CLIENT_SECRET',
          args: { scope: 'user:email,repo' } }
Defensive patterns

Strategy: validation

Validate before calling

# Guard the import entry point on config presence
require 'gitlab_config'
cfg = Gitlab.config
has_github = cfg.omniauth&.providers&.any? { |p| p['name'] == 'github' && p['app_id'].present? }
raise 'Configure the GitHub OAuth provider before importing' unless has_github

Prevention

When it happens

Trigger: Starting the GitHub import flow (GET /import/github or /import/github/status) on an instance where the GitHub OmniAuth provider was never configured or its credentials env vars are empty (typical in fresh GDK/dev setups).

Common situations: Development environments omitting the github provider block; production instances where the provider secret was not provisioned after deploy; provider key renamed or yml indentation broken so the section is ignored.

Related errors


AI-assisted analysis of gitlabhq/gitlabhq@55ee20384a (2026-08-21). Data as JSON: /api/errors/b1763dbafac119e0. Report an issue: GitHub.