How to integrate diagrams.net/draw.io with self-hosted GitLab

draw.iogitlab

diagrams.net (formerly known as draw.io) integrates with GitLab. However, when I try to authenticate, it redirects me to gitlab.com when I'd like to connect to a self-hosted GitLab instance at company.gitlab.com. How do I tell diagrams.net to authenticate to my self-hosted GitLab instance instead?

Best Answer

You can only do that with a self-hosted draw.io instance. You also need to have your gitlab admin configure an application first.

In short:

  1. Add application to gitlab.company.com. The REDIRECT_URI would be something like https://drawio.company.com/gitlab.html (the gitlab.html is important)
  2. The Application ID needs to go to draw.io conf file as window.DRAWIO_GITLAB_ID
  3. In the same config set window.DRAWIO_GITLAB_URL to your gitlab instance, like https://gitlab.company.com
  4. The secret token from gitlab is not required.

If you run your self-hosted draw.io in docker, you can pass the configuration as env vars. In this case omit the window. part