Single Sign On with PocketID for your services behind Cloudflare zero trust

This post is an update on my 2023 post that was using Authentik.

I’ve moved away from Authentik because I was probably using 1% of the tool.

I settled on PocketID because I expect it to be simpler to maintain.

Assumptions:

You will need to find the name of your Cloudflare team:

Deploy PocketID:

Create a docker-compose.yml file:

services:
  pocket-id:
    image: ghcr.io/pocket-id/pocket-id:v2
    restart: unless-stopped
    env_file: env
    ports:
      - 1411:1411
    volumes:
      - "/local/path/data:/app/data"
    healthcheck:
      test: [ "CMD", "/app/pocket-id", "healthcheck" ]
      interval: 1m30s
      timeout: 5s
      retries: 2
      start_period: 10s

Create an env file:

APP_URL=https://id.example.com

# Encryption key (choose one method):
# Method 1: Direct key (simple but less secure)
# Generate with: openssl rand -base64 32
ENCRYPTION_KEY=somerandomencryptionkeythatshouldbe32characters
TRUST_PROXY=true
MAXMIND_LICENSE_KEY=
PUID=1000
PGID=1000

# opting out callbacks
ANALYTICS_DISABLED=true
VERSION_CHECK_DISABLED=true

# Explicitly refuse signups
ALLOW_USER_SIGNUPS=false

Deploy PocketID with docker-compose up -d in the folder of both files.

Configure Cloudflare Zero Trust to make PocketID publicly accessible.

Make sure you have an Edge certificate for your services:

You should be able to access PocketID:

Once this is all figured out, we can start getting busy in PocketID:

Now go to Cloudflare Zero Trust.

Choose your account.

Create an identity provider:

Still in Cloudflare Zero trust, create an application:

Go to your website.

Cloudflare will redirect you to PocketID.

Log into your account with your passkey saved earlier.

You can now access your website!




Thanks for reading this post!


Did you find an issue in this article?

- click on the following Github link
- log into Github with your account
- click on the line number containing the error
- click on the "..." button
- choose "Reference in new issue"
- add a title and your comment
- click "Submit new issue"

Your feedback is much appreciated! πŸ€œπŸΌπŸ€›πŸΌ

You can also drop me a line below!