跳到主内容

Add GitLab as an OAuth provider

This guide explains how to let users sign in to Casdoor with their account on GitLab.com or on a self-hosted GitLab instance.


Learning outcomes​

  • Create an OAuth application in GitLab.
  • Add GitLab as an OAuth provider in Casdoor.

What you need​

  • A GitLab account
  • Administrator access to the Casdoor admin console

创建 GitLab 应用​

  1. Open the Applications page of your profile. On a self-hosted GitLab, the page is https://<your-gitlab>/-/profile/applications.

  2. 点击 Add new application。

  3. Fill in the fields:

    • Name: For example Casdoor.
    • Redirect URI: The callback URL of Casdoor, https://<your-casdoor-host>/callback. See Redirect URL and callback URL.
    • Scopes: Select at least read_user and profile. Without them, sign-in can fail.
  4. Save the application and copy the Application ID and the Secret.

在 Casdoor 中添加提供商​

  1. In the Casdoor admin console, go to Identity > Providers and add a provider.
  2. Set Category to OAuth and Type to GitLab.
  3. Enter the Application ID as the Client ID and the Secret as the Client secret.
  4. Save the provider.

Next steps​

Add the provider to an application. See Add providers to an application.

See also​