Skip to main content

Integrate with wg-easy

Support level: Community

What is wg-easy?

wg-easy is a self-hosted web UI for the WireGuard VPN. It manages the WireGuard server and its clients from the browser, including client creation, QR codes for mobile setup, and connection statistics.

-- https://wg-easy.github.io/wg-easy/

Preparation

The following placeholders are used in this guide:

  • wg-easy.company is the FQDN of the wg-easy installation.
  • authentik.company is the FQDN of the authentik installation.
info

This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.

wg-easy version

External authentication via OIDC is supported in wg-easy version 15.4 and later.

authentik configuration

To support the integration of wg-easy with authentik, you need to create an application/provider pair in authentik.

Create a custom scope mapping

wg-easy only accepts logins where the email scope returns email_verified: True. Because the default authentik email scope mapping returns email_verified: False, create a custom scope mapping for wg-easy.

  1. Log in to authentik as an administrator and open the authentik Admin interface.

  2. Navigate to Customization > Property Mappings and click Create.

    • Select type: select Scope Mapping.

    • Configure the Scope Mapping: provide a descriptive name (e.g. wg-easy Email Scope), and an optional description.

      • Scope name: email
      • Expression:
      return {
      "email": request.user.email,
      "email_verified": True
      }
  3. Click Finish to save the property mapping.

Create an application and provider

Redirect URI changes in authentik 2026.5

In authentik versions earlier than 2026.5, all Redirect URIs are automatically treated as Authorization type. If you are using one of these older authentik versions, add only the Authorization URL to your Redirect URIs and do not configure a Post Logout URI.

  1. Navigate to Applications > Applications and click New Application to open the application wizard.

    • Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings. Note the Slug value because it is required later.
    • Choose a Provider type: select OAuth2/OpenID Connect as the provider type.
    • Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
      • Note the Client ID and Client Secret values because they are required later.
      • Add two Redirect URI entries of type Strict Authorization: https://wg-easy.company/api/auth/oidc/callback and https://wg-easy.company/api/auth/oidc/link. The second URI is used when linking an existing wg-easy account to authentik.
      • Select any available signing key.
      • Under Advanced protocol settings, remove the authentik default OAuth Mapping: OpenID 'email' scope from Selected Scopes and add the custom scope mapping that you created in the previous section.
    • Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's Application Dashboard page.
  2. Click Submit to save the new application and provider.

wg-easy configuration

wg-easy uses environment variables to configure external authentication. Add the following variables to the environment file for the wg-easy container, then restart the container:

.env
OAUTH_PROVIDERS=oidc
OAUTH_OIDC_NAME=authentik
OAUTH_OIDC_SERVER=https://authentik.company/application/o/<application_slug>/
OAUTH_OIDC_CLIENT_ID=<Client ID from authentik>
OAUTH_OIDC_CLIENT_SECRET=<Client Secret from authentik>
OAUTH_AUTO_REGISTER=true
Auto-registered users

wg-easy creates auto-registered users with administrator permissions because its permissions system is not yet implemented. Every authentik user who is allowed to access the application can manage the WireGuard server. Set OAUTH_AUTO_REGISTER=false to only allow existing wg-easy users to log in after linking their authentik account.

To make authentik the only login method for wg-easy, you can add the following variables:

.env
DISABLE_PASSWORD_AUTH=true
OAUTH_AUTO_LAUNCH=oidc

Configuration verification

To confirm that authentik is properly configured with wg-easy, log out of wg-easy and click Sign in with authentik on the login page. You should be redirected to authentik, then returned to wg-easy after a successful login.

Resources