# Authentik First-Time Setup After the bootstrap script completes, Authentik is running but needs to be configured. This guide walks through the initial setup. ## 1. Access Authentik Open https://auth.dezky.local in your browser. If you see a TLS warning, mkcert root CA isn't trusted yet. Run: ```bash mkcert -install ``` Then restart your browser. ## 2. Initial admin setup Authentik bootstraps with admin credentials from `.env`: - **URL:** https://auth.dezky.local/if/flow/initial-setup/ - **Email:** admin@dezky.local - **Password:** Value of `AUTHENTIK_BOOTSTRAP_PASSWORD` in `.env` On first login, change the password immediately. ## 3. Configure OIDC providers Each Dezky service that uses SSO needs an OIDC provider configured in Authentik. ### 3.1 Create OCIS provider 1. Go to **Admin Interface** → **Applications** → **Providers** 2. Click **Create** 3. Select **OAuth2/OpenID Provider** 4. Configure: - **Name:** `ocis-provider` - **Authorization flow:** `default-provider-authorization-implicit-consent` - **Client type:** Public - **Client ID:** `ocis-web` - **Redirect URIs:** ``` https://files.dezky.local/ https://files.dezky.local/oidc-callback ``` - **Signing Key:** `authentik Self-signed Certificate` - **Scopes:** openid, profile, email 5. Save ### 3.2 Create OCIS application 1. Go to **Applications** → **Applications** 2. Click **Create** 3. Configure: - **Name:** `OCIS Files` - **Slug:** `ocis` - **Provider:** `ocis-provider` (just created) - **Launch URL:** https://files.dezky.local 4. Save ### 3.3 Create portal provider Same steps as OCIS, but with: - **Provider name:** `dezky-portal` - **Client ID:** `dezky-portal` - **Redirect URIs:** `https://app.dezky.local/api/auth/callback` - **Client type:** Confidential (Authentik will generate a Client Secret) Then create the matching application: - **Name:** `Dezky Portal` → slug auto-generates as `dezky-portal` - **Provider:** `dezky-portal` (from above) - **Launch URL:** `https://app.dezky.local` The resulting issuer URL is `https://auth.dezky.local/application/o/dezky-portal/` — note the slug includes `dezky-`. After creating, copy the generated client secret into `.env`: ``` PORTAL_OIDC_CLIENT_ID=dezky-portal PORTAL_OIDC_CLIENT_SECRET= PORTAL_OIDC_ISSUER=https://auth.dezky.local/application/o/dezky-portal/ ``` `docker-compose.yml` passes these to the portal container as `NUXT_OIDC_*`, which `nuxt-oidc-auth` (added in Phase 2) consumes. ### Scripted alternative If you don't want to click through the UI, this one-shot uses the API token from section 4: ```bash TOKEN=$(grep ^AUTHENTIK_BOOTSTRAP_TOKEN .env | cut -d= -f2) BASE=https://auth.dezky.local/api/v3 AUTH="Authorization: Bearer $TOKEN" # Pull the same authorization flow + signing key + scope mappings that OCIS uses FLOW=$(curl -k -s -H "$AUTH" "$BASE/flows/instances/?slug=default-provider-authorization-implicit-consent" | jq -r '.results[0].pk') KEY=$(curl -k -s -H "$AUTH" "$BASE/providers/oauth2/?search=ocis" | jq -r '.results[0].signing_key') MAPS=$(curl -k -s -H "$AUTH" "$BASE/providers/oauth2/?search=ocis" | jq -c '.results[0].property_mappings') # Create provider PK=$(curl -k -s -X POST -H "$AUTH" -H "Content-Type: application/json" "$BASE/providers/oauth2/" -d "{ \"name\": \"dezky-portal\", \"client_id\": \"dezky-portal\", \"client_type\": \"confidential\", \"authorization_flow\": \"$FLOW\", \"signing_key\": \"$KEY\", \"redirect_uris\": [{\"matching_mode\": \"strict\", \"url\": \"https://app.dezky.local/api/auth/callback\"}], \"property_mappings\": $MAPS, \"sub_mode\": \"hashed_user_id\", \"issuer_mode\": \"per_provider\" }" | jq -r '.pk') # Create app curl -k -s -X POST -H "$AUTH" -H "Content-Type: application/json" "$BASE/core/applications/" -d "{ \"name\": \"Dezky Portal\", \"slug\": \"dezky-portal\", \"provider\": $PK, \"meta_launch_url\": \"https://app.dezky.local\" }" >/dev/null # Read the generated secret and write to .env SECRET=$(curl -k -s -H "$AUTH" "$BASE/providers/oauth2/$PK/" | jq -r '.client_secret') cat >> .env <