DingTalk OAuth 2.0 OmniAuth provider

Introduced in GitLab 14.5.

You can sign in to GitLab using your DingTalk account. Sign in to DingTalk Open Platform and create an application on it. DingTalk generates a client ID and secret key for you to use.

  1. Sign in to DingTalk Open Platform.

  2. On the top bar, select Application development > Enterprise internal development and then select Create Application.

    DingTalk menu

  3. Fill in the application details:

    • Application Name: This can be anything. Consider something like <Organization>'s GitLab, or <Your Name>'s GitLab, or something else descriptive.
    • Application Description: Create a description.
    • Application icon: Upload qualified icons if needed.

    DingTalk create application

  4. Select Confirm and create.

  5. On the left sidebar, select DingTalk Application and find your application. Select it and go to the application information page.

    DingTalk your application

  6. Under the Application Credentials section, there should be an AppKey and AppSecret (see the screenshot). Keep this page open as you continue the configuration.

    DingTalk credentials

  7. On your GitLab server, open the configuration file.

    For Omnibus package:

    sudo editor /etc/gitlab/gitlab.rb
    

    For installations from source:

    cd /home/git/gitlab
    
    sudo -u git -H editor config/gitlab.yml
    
  8. See Configure initial settings for initial settings.

  9. Add the provider configuration:

    For Omnibus package:

      gitlab_rails['omniauth_providers'] = [
        {
          name: "dingtalk",
          # label: "Provider name", # optional label for login button, defaults to "Ding Talk"
          app_id: "YOUR_APP_ID",
          app_secret: "YOUR_APP_SECRET"
        }
      ]
    

    For installations from source:

    - { name: 'dingtalk',
        # label: 'Provider name', # optional label for login button, defaults to "Ding Talk"
        app_id: 'YOUR_APP_ID',
        app_secret: 'YOUR_APP_SECRET' }
    
  10. Change YOUR_APP_ID to the AppKey from the application information page in step 6.

  11. Change YOUR_APP_SECRET to the AppSecret from the application information page in step 6.

  12. Save the configuration file.

  13. For the changes to take effect: