This document explains how to implement Monosign with Headscale, the open source, self-hosted implementation of the Tailscale control server (WireGuard based VPN). Headscale has built-in support for OpenID Connect (OIDC), so users register their devices by signing in with Monosign. Headscale uses the Authorization Code flow, so the OIDC/OpenID access key of Monosign is used. Before you continue, it is better to read the Headscale documentation (opens in a new tab).
This configuration was tested with Headscale v0.29.7 (Docker) and the Tailscale client for macOS. If your version is different, please check the Headscale documentation.
Headscale reads the OIDC settings from its configuration file (config.yaml); there is no administration page for it. SAML is not supported by Headscale.
Monofor has no responsibility to do Headscale configurations. If you need support please contact the Headscale community or your Headscale support provider.
Instructions
This documentation contains 5 main steps for integration.
Creating an application on Monosign
Configuring the OIDC/OpenID settings on Monosign
Assign a user to the Headscale application
Configuration Single Sign-On for Headscale
Sign In Test
1- Creating an Application on Monosign
Create your application on Monosign first. Open the Applications page from the left menu and click Add New.
Headscale is not in the application catalog, so click Create from scratch.
Fill in the application details on the Application tab and click Next.
Property | Value | Description |
|---|---|---|
Name |
| Name of the application shown to users on the Monosign portal and on the Monosign sign-in page. |
Type |
| Options: Web, Mobile, Desktop, API. |
Url | Optional | Leave empty or enter the address of Headscale (for example |
Logo | Optional | Browse and upload a logo (PNG or JPG, max 1 MB); it is also shown on the Monosign sign-in page. |
Users can see this application on their list |
| Displays the application on the user portal. |
On the Access tab keep the defaults (System Default) and click Create Application. Headscale needs the e-mail address, the user name and the name of the user, so the profile attributes must be available to the application.
After the application is created, click Keys and add a new Access Key for OIDC/OpenID access.
Select OIDC/OpenID as the key type and click Create. Monosign generates the Client Id and Client Secret automatically.
Monosign value | Example | Used in Headscale as |
|---|---|---|
Client Id |
|
|
Client Secret |
|
|
Issuer |
|
|
2- Configuring the OIDC/OpenID Settings on Monosign
Open the Keys tab of the application and click the Configure button of the OpenID Connect (OIDC) key.
Open the OIDC/OpenID Settings tab, enter the scopes in the Scope field (press Enter after each scope), add the callback address of Headscale to Allowed Redirect URIs and press Update.
Property | Value | Description |
|---|---|---|
Allowed Redirect URIs |
| The address where Monosign sends the user back after sign-in. |
Scope |
| Enter the three scopes one by one. |
Other fields | Empty / default | The other fields are not needed. |
3- Assign a User to the Headscale Application
Open the application in Monosign, click the Assignments tab and click Assign a User.
Search and select the users who can register devices, check the Expiration Date and save. You can select more than one user. Every user needs an e-mail address in Monosign.
4- Configuration Single Sign-On for Headscale
As we mentioned at the start, please check out the Headscale documentation first. Open the Headscale configuration file (config.yaml) and add the oidc block below, then restart Headscale.
oidc:
only_start_if_oidc_is_available: true
issuer: "https://<monosign-host>/"
client_id: "<client-id>"
client_secret: "<client-secret>"
email_verified_required: false
scope: ["openid", "profile", "email"]
pkce:
enabled: true
method: S256
Field | Value | Description |
|---|---|---|
issuer |
| Address of Monosign with the slash at the end. |
client_id, client_secret | Client Id, Client Secret | Copied from the Monosign OIDC/OpenID access key created in the first step. |
email_verified_required |
| Monosign does not send the |
scope |
| Same scopes as in Monosign. |
pkce |
| Optional; Monosign supports PKCE. |
If Headscale runs in Docker and the configuration file is mounted, restart the container (for example docker restart headscale). At the start Headscale contacts Monosign and fails to start if the issuer cannot be reached (only_start_if_oidc_is_available).
Headscale takes the user name, e-mail address and name from the preferred_username, email and name claims, so these must be available for the user in Monosign. The Headscale user is created automatically at the first sign-in. To limit who can register, allowed_domains, allowed_users and allowed_groups can be added to the same block.
5- Sign In Test
Headscale does not have a sign-in page. The sign-in starts when a device is registered with the Tailscale client. Install the Tailscale client on the device and tell it to use your Headscale server instead of the Tailscale service.
Command line (Linux, Windows, macOS): run
tailscale up --login-server https://<headscale-address>.Tailscale application for macOS (installed outside the App Store): run
defaults write io.tailscale.ipn.macsys ControlURL https://<headscale-address>and restart the application. For the App Store version useio.tailscale.ipn.macos.
Click Sign in to your network in the client (or open the address printed by the command). The client shows Authentication In Progress and opens the browser.
The browser opens the Monosign sign-in page. Sign in with your QR code (Monofor Identity), with a Passkey or with your user name and password. If you are already signed in to Monosign, the page is skipped.
After the sign-in Monosign redirects the browser back to Headscale (/oidc/callback). Headscale shows the Confirm node registration page with the host name and the operating system of the device and the user it is registered to. Check the details and click Confirm registration.
Headscale creates the user at the first sign-in and registers the device. The page Node registered confirms it; you can close the window.
The client shows Connected and lists the device under the user in the Devices page.
You can also check the result on the Headscale server:
docker exec headscale headscale users list docker exec headscale headscale nodes list
To sign out, open the Tailscale menu, open the account of the user and click Log out. The next Log in starts the Monosign sign-in again. If you are still signed in to Monosign the password is not asked again; sign out of Monosign as well to see the sign-in page.
The users that sign in through Monosign are separate Headscale users. Real-time (UDP) connections between devices need the Headscale server to be reachable directly; the sign-in itself works through an HTTPS reverse proxy.
Troubleshooting
Symptom | Cause | Solution |
|---|---|---|
Headscale does not start | Monosign cannot be reached or the issuer is wrong. | Use the issuer with the slash at the end and check that Monosign opens from the Headscale server. |
Monosign shows a redirect URI error | The callback address does not exactly match the Allowed Redirect URIs. | Use |
An error appears after returning from Monosign | Wrong Client Id or Client Secret, or | Check the values (steps 1 and 4). |
A user cannot sign in | The user is not assigned to the application. | Assign the user in step 3. |
After completing the configuration on Headscale and Monosign, it is better to test in a new private browser window if the OIDC SSO doesn’t work, because old session cookies may cause errors.












