# Linking Authentik SSO to Nextcloud (OIDC)

<div id="bkmrk-purpose%3A-this-guide-" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;"><div style="background-color: #e8f4fd; border-left: 5px solid #3498db; padding: 15px; margin: 20px 0; border-radius: 4px;">**Purpose:** This guide outlines the steps to enable Single Sign-On (SSO) for Nextcloud using Authentik via the OpenID Connect (OIDC) protocol. This allows users to log in to Nextcloud using their central Authentik credentials.</div></div>## Prerequisites

<div id="bkmrk-a-working-authentik-" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;">- A working **Authentik** instance (e.g., `auth.goonersnas.com`).
- A working **Nextcloud** instance (e.g., `nc.goonersnas.com`).
- Administrator access to both platforms.

---

</div>## Step 1: Create the Authentik Provider

The Provider acts as the authentication engine for the handshake.

<div id="bkmrk-navigate-to-applicat" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;">1. Navigate to **Applications &gt; Providers** in the Authentik Admin interface.
2. Click **Create** and select **OAuth2/OpenID Provider**.
3. Set the following values: <table style="width: 100%; border-collapse: collapse; margin: 15px 0;"><thead><tr style="background-color: #f8f9fa;"><th style="border: 1px solid #dee2e6; padding: 8px; text-align: left;">Field</th><th style="border: 1px solid #dee2e6; padding: 8px; text-align: left;">Value</th></tr></thead><tbody><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Name**</td><td style="border: 1px solid #dee2e6; padding: 8px;">Nextcloud</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Authentication flow**</td><td style="border: 1px solid #dee2e6; padding: 8px;">default-authentication-flow</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Authorization flow**</td><td style="border: 1px solid #dee2e6; padding: 8px;">default-provider-authorization-implicit-consent</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Client Type**</td><td style="border: 1px solid #dee2e6; padding: 8px;">Confidential</td></tr></tbody></table>
4. In the **Redirect URIs** section, add the following (adjust domain as needed):

</div>```
https://nc.goonersnas.com/index.php/apps/sociallogin/custom_oidc/authentik
```

Click **Finish** and then copy your **Client ID** and **Client Secret** from the provider details page.

## Step 2: Create the Authentik Application

The Application links the Provider to a user-facing icon.

<div id="bkmrk-navigate-to-applicat-1" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;">1. Navigate to **Applications &gt; Applications**.
2. Click **Create**.
3. **Name:** Nextcloud | **Slug:** nextcloud
4. **Provider:** Select the "Nextcloud" provider created in Step 1.
5. Click **Finish**.

---

</div>## Step 3: Configure Nextcloud Social Login

Install the **Social Login** app from the Nextcloud App Store, then navigate to **Settings &gt; Administration &gt; Social login**.

### 3.1 General Settings

Check the following boxes at the top of the page:

<div id="bkmrk-uncheck%3A-%22disable-au" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;">- **Uncheck:** "Disable auto-create new users" (to allow SSO to create accounts).
- **Check:** "Allow users to connect social logins with their account".
- **Check:** "Update user profile every login".

</div>### 3.2 Custom OpenID Connect

Click the **+** button under Custom OpenID Connect and fill in the following:

<div id="bkmrk-nextcloud-field-auth" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;"><table style="width: 100%; border-collapse: collapse; margin: 15px 0;"><thead><tr style="background-color: #f8f9fa;"><th style="border: 1px solid #dee2e6; padding: 8px; text-align: left;">Nextcloud Field</th><th style="border: 1px solid #dee2e6; padding: 8px; text-align: left;">Authentik URL Path</th></tr></thead><tbody><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Internal name**</td><td style="border: 1px solid #dee2e6; padding: 8px;">authentik</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Authorize URL**</td><td style="border: 1px solid #dee2e6; padding: 8px;">https://auth.goonersnas.com/application/o/authorize/</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Token URL**</td><td style="border: 1px solid #dee2e6; padding: 8px;">https://auth.goonersnas.com/application/o/token/</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**User info URL**</td><td style="border: 1px solid #dee2e6; padding: 8px;">https://auth.goonersnas.com/application/o/userinfo/</td></tr><tr><td style="border: 1px solid #dee2e6; padding: 8px;">**Scope**</td><td style="border: 1px solid #dee2e6; padding: 8px;">openid profile email</td></tr></tbody></table>

<div style="background-color: #fff3cd; border-left: 5px solid #ffc107; padding: 15px; margin: 20px 0; border-radius: 4px;">**Important:** Ensure there are no leading or trailing spaces in the Client ID or Client Secret fields.</div>---

</div>## Step 4: Final Testing

<div id="bkmrk-open-an-incognito-wi" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; max-width: 900px; margin: auto; border: 1px solid #e1e4e8; padding: 40px; border-radius: 8px; background-color: #ffffff;">1. Open an **Incognito Window**.
2. Navigate to your Nextcloud URL.
3. Click the large **Authentik** button at the bottom of the login form.
4. Log in with your Authentik credentials.

<div style="background-color: #d4edda; border-left: 5px solid #28a745; padding: 15px; margin: 20px 0; border-radius: 4px;">**Success!** If redirected to your Nextcloud dashboard, the SSO link is active. New users created in Authentik will now automatically have Nextcloud accounts provisioned on their first login.</div></div>