NewCode CLOUD — 20% off your first month on all cloud VPSClaim

Authentik SSO on Hong Kong VPS: Self-Hosted Identity Provider (2026)

· 3 min read

Authentik is the open-source identity provider that replaces Okta and Auth0 for self-hosted teams — supporting OIDC, SAML 2.0, LDAP, SCIM, and OAuth2 from a single platform. Deploying on a Hong Kong VPS puts your SSO endpoint at CN2 GIA latency for Asia-Pacific employees and applications, keeps identity data off US cloud providers, and eliminates Okta’s $2–15/user/month pricing for teams of 10–500.


What Authentik Provides

Feature Details
OIDC / OAuth2 SSO for modern apps (Next.js, React, mobile)
SAML 2.0 SSO for enterprise apps (Jira, Confluence, Salesforce)
LDAP Directory for legacy apps
SCIM User provisioning/deprovisioning to connected apps
MFA TOTP, WebAuthn, Duo, SMS
Social login Google, GitHub, WeChat, Feishu, Lark
Forward auth Protect any app with Nginx forward auth proxy
Flows Customisable login, enrolment, recovery flows

Step 1: Install with Docker Compose

<code">mkdir -p /opt/authentik && cd /opt/authentik

# Download official docker-compose.yml
wget https://goauthentik.io/docker-compose.yml

# Generate secrets
echo "PG_PASS=$(openssl rand -hex 32)" >> .env
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -hex 32)" >> .env
echo "AUTHENTIK_ERROR_REPORTING__ENABLED=false" >> .env

# Add your HK VPS domain
echo "AUTHENTIK_EMAIL__HOST=smtp.yourprovider.com" >> .env
echo "AUTHENTIK_EMAIL__PORT=587" >> .env
echo "AUTHENTIK_EMAIL__FROM=authentik@yourdomain.com" >> .env
echo "AUTHENTIK_EMAIL__USERNAME=noreply@yourdomain.com" >> .env
echo "AUTHENTIK_EMAIL__PASSWORD=SMTP_PASS" >> .env

docker compose pull
docker compose up -d

Step 2: Nginx Reverse Proxy

<code">cat > /etc/nginx/sites-available/authentik << 'EOF'
server {
    listen 443 ssl http2;
    server_name sso.yourdomain.com;
    ssl_certificate /etc/letsencrypt/live/sso.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/sso.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:9000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 300;
    }

    # WebSocket for outpost communication
    location /ws/outpost/ {
        proxy_pass http://127.0.0.1:9000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
    }
}
EOF
certbot --nginx -d sso.yourdomain.com
nginx -t && systemctl reload nginx

Step 3: Create OIDC Application

<code"># Authentik Admin → Applications → Create
# Name: My App
# Slug: my-app
# Provider: Create new OAuth2/OIDC provider

# Provider settings:
# Name: My App OIDC
# Client type: Confidential
# Client ID: (auto-generated, copy it)
# Client Secret: (auto-generated, copy it)
# Redirect URIs: https://app.yourdomain.com/auth/callback
# Scopes: openid, email, profile

# Your app (Next.js with next-auth):
import NextAuth from 'next-auth'
export default NextAuth({
  providers: [{
    id: 'authentik',
    name: 'Authentik',
    type: 'oauth',
    wellKnown: 'https://sso.yourdomain.com/application/o/my-app/.well-known/openid-configuration',
    clientId: 'CLIENT_ID',
    clientSecret: 'CLIENT_SECRET',
    profile(profile) {
      return {
        id: profile.sub,
        name: profile.name,
        email: profile.email,
        image: profile.picture,
      }
    }
  }],
})

Step 4: Forward Auth for Any Application

<code"># Protect any application behind Authentik without code changes
# Authentik: Applications → Outpost → Create embedded outpost

# Nginx forward auth config (protects Grafana, internal tools, etc.)
server {
    listen 443 ssl http2;
    server_name grafana.yourdomain.com;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    # Forward auth check
    location /outpost.goauthentik.io {
        proxy_pass http://127.0.0.1:9000;
        proxy_set_header Host $host;
        proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location / {
        auth_request /outpost.goauthentik.io/auth/nginx;
        error_page 401 = @goauthentik_proxy_signin;
        auth_request_set $auth_cookie $upstream_http_set_cookie;
        add_header Set-Cookie $auth_cookie;
        auth_request_set $user $upstream_http_x_authentik_username;
        proxy_set_header X-Forwarded-User $user;

        proxy_pass http://127.0.0.1:3000;  # Grafana
    }

    location @goauthentik_proxy_signin {
        internal;
        add_header Set-Cookie $auth_cookie;
        return 302 /outpost.goauthentik.io/start?rd=$scheme://$http_host$request_uri;
    }
}

Step 5: Asian Social Login (WeChat, Feishu)

<code"># Authentik supports WeChat Work / Feishu (Lark) OAuth
# Admin → Directory → Federation → Add

# WeChat Work (企业微信):
# Application Type: WeChat Work
# App ID: YOUR_CORP_ID
# App Secret: YOUR_APP_SECRET
# Agent ID: YOUR_AGENT_ID

# Feishu/Lark:
# Application Type: Feishu
# App ID: YOUR_FEISHU_APP_ID
# App Secret: YOUR_FEISHU_APP_SECRET

# After setup, users in mainland China can log in with their
# corporate WeChat Work or Feishu accounts — no separate account needed

Cost Comparison

Users Authentik (HK VPS) Okta Workforce Auth0
10 users ~$20–40/month (VPS) ~$20/month $23/month
50 users ~$20–40/month (same VPS) ~$100/month ~$115/month
200 users ~$40–80/month (larger VPS) ~$400/month ~$460/month
500 users ~$40–80/month ~$1000/month ~$1150/month

Conclusion

Authentik on a Hong Kong VPS provides enterprise-grade identity management for Asia-Pacific teams at 1/10th the cost of Okta or Auth0 at scale. WeChat Work and Feishu social login integration makes onboarding frictionless for mainland Chinese employees; OIDC and SAML 2.0 support covers every modern and legacy SaaS application; and Nginx forward auth protects internal tools without code changes. For any organisation with 50+ users and mixed Asia-Pacific and global applications, Authentik pays for itself against Okta pricing within the first month.

Own your identity stack: Browse Server.HK Hong Kong VPS plans — a 4 GB plan handles Authentik with its PostgreSQL and Redis dependencies for teams up to several hundred users.

Related articles

More in VPS & ServersServer setup guides