Skip to main content

OpenID Connect (OIDC)

Yopass supports OpenID Connect for user authentication. When configured, a Sign in button appears in the navbar and you can optionally restrict secret creation to authenticated users only.

Requires a valid license. OIDC is a premium feature gated behind --license-key. With no license key at all, the server refuses to start rather than silently ignoring --oidc-issuer. Once a license has been provided, expiry degrades gracefully instead of turning OIDC off — see expiry behavior.


How it works​

  1. A user clicks Sign in in the navbar.
  2. The browser is redirected to /auth/login, which redirects to your OIDC provider.
  3. After the user authenticates, the provider redirects back to /auth/callback.
  4. Yopass exchanges the authorization code for tokens, reads the user's sub, email, and name from the UserInfo endpoint, and stores them in a signed, encrypted session cookie.
  5. The navbar shows the user's name and a Sign out button.
  6. Secrets can be created for public (unauthenticated) or internal (authenticated-only) consumption.

Flags​

FlagEnv varDefaultDescription
--oidc-issuerOIDC_ISSUER—OIDC provider issuer URL
--oidc-client-idOIDC_CLIENT_ID—OAuth2 client ID
--oidc-client-secretOIDC_CLIENT_SECRET—OAuth2 client secret
--oidc-redirect-urlOIDC_REDIRECT_URL—Full callback URL (must match the provider)
--require-authREQUIRE_AUTHfalseReject secret creation requests from unauthenticated users
--require-auth-allREQUIRE_AUTH_ALLfalseRequire sign-in for every user operation except providing a secret for a secret request. Implies --require-auth
--oidc-session-keyOIDC_SESSION_KEY—64-byte hex session key (see Multi-instance)
--oidc-allowed-domainsOIDC_ALLOWED_DOMAINS—Restrict OIDC logins and authenticated access to these email domains, comma-separated (e.g. corp.example.com,example.com)
--oidc-require-verified-emailOIDC_REQUIRE_VERIFIED_EMAILtrueRequire the provider to return email_verified: true for new logins. false cannot be combined with restricted recipients, which are matched on verified addresses only
--oidc-verified-email-claimOIDC_VERIFIED_EMAIL_CLAIM—ID token claim that also counts as a verified email, for providers that do not send email_verified (see Microsoft Entra ID)
--api-tokenAPI_TOKEN—Static bearer token(s) for machine clients, formatted as name:secret (see Machine-to-machine)

All three of --oidc-issuer, --oidc-client-id, and --oidc-redirect-url are required to enable OIDC.

Email verification​

By default, new OIDC logins require email_verified: true in the provider's UserInfo response, even when no email domains are restricted. A missing or false claim returns 403 Forbidden and no session is created. API tokens are unaffected.

Check your provider's UserInfo claims. OIDC permits providers to omit email_verified; requesting the email scope does not guarantee it will be returned. The Microsoft identity platform UserInfo endpoint, for example, documents subject, name, and email claims without email_verified.

Microsoft Entra ID​

Entra ID does not send email_verified, but it can put its own verification claims in the ID token. Name one with --oidc-verified-email-claim and Yopass treats it as proof of a verified address. Keep --oidc-require-verified-email at its default; email notifications and restricted recipients then work as with any other provider.

  1. In the Entra admin center, open your app registration and add email and xms_edov as optional claims for the ID token. Entra sends neither by default. If Token configuration does not offer xms_edov, add it under optionalClaims.idToken in the app manifest.
  2. Start Yopass with:
--oidc-verified-email-claim=xms_edov

or OIDC_VERIFIED_EMAIL_CLAIM=xms_edov.

  1. Have users sign in again. Sessions from before the change still count as unverified.

Two kinds of claim are accepted, both read from the signed ID token:

Claim valueExampleCounts as verified when
true, "true" or "1"xms_edovthe ID token's email is the address signing in
An address or a list of addressesverified_primary_emailit holds the address signing in

Addresses are compared case-insensitively. A login whose claim is missing, false or names another address is refused like any other unverified login.

Only name a claim your provider documents as verified. Any claim that repeats the user's address would pass, including ones the provider does not vouch for, such as preferred_username. The server refuses to start with email as the claim.

Removing the option only affects new logins. Sessions already signed in keep their verified address until they expire, at most 24 hours later.

xms_edov is the claim Microsoft documents for this. It says the email's domain is verified by the tenant the user belongs to, not that the mailbox was confirmed, and it is also true for Microsoft account, Google and one-time passcode guests. Set --oidc-issuer to your own tenant (https://login.microsoftonline.com/<tenant-id>/v2.0), never common or organizations, which stand for every tenant. Set --oidc-allowed-domains to your own domains and restrict the Yopass application to the intended users or groups. See Microsoft's optional claims reference.

Disabling the requirement​

For providers that omit verification and have no such claim, administrators can explicitly disable this requirement. Restricted recipients, which are matched on verified addresses only, cannot be turned on then. Disable it with either:

--oidc-require-verified-email=false

or the environment variable:

OIDC_REQUIRE_VERIFIED_EMAIL=false

This opt-out accepts both missing and explicitly false verification claims. It does not bypass subject validation or --oidc-allowed-domains, and the server logs a startup warning when it is enabled with OIDC. Yopass then trusts the provider's email assertion without evidence of verification. Use it only when the provider controls the email attribute and application access appropriately.

For Microsoft Entra deployments, prefer the verification claim over this opt-out. If you do opt out, configure the intended tenant and restrict access to the Yopass application to the intended users or groups, including an explicit guest-access policy. Ensure users cannot supply an arbitrary allowed-domain email attribute. An email suffix alone does not establish organization membership. Do not enable the opt-out merely to make a login error disappear without checking these controls.


Example: Google as OIDC provider​

1. Create a Google OAuth 2.0 client​

  1. Open Google Cloud Console and select your project (or create one).
  2. Go to APIs & Services → Credentials.
  3. Click Create Credentials → OAuth 2.0 Client ID.
  4. Set the application type to Web application.
  5. Under Authorized redirect URIs, add your callback URL:
    https://yopass.example.com/auth/callback
  6. Click Create. Copy the Client ID and Client Secret.

2. Run Yopass with OIDC enabled​

yopass-server \
--license-key "your-license-key" \
--oidc-issuer "https://accounts.google.com" \
--oidc-client-id "123456789-abc.apps.googleusercontent.com" \
--oidc-client-secret "GOCSPX-…" \
--oidc-redirect-url "https://yopass.example.com/auth/callback"

Or with environment variables:

LICENSE_KEY=your-license-key \
OIDC_ISSUER=https://accounts.google.com \
OIDC_CLIENT_ID=123456789-abc.apps.googleusercontent.com \
OIDC_CLIENT_SECRET=GOCSPX-… \
OIDC_REDIRECT_URL=https://yopass.example.com/auth/callback \
yopass-server

Yopass fetches Google's discovery document (https://accounts.google.com/.well-known/openid-configuration) at startup. If the provider is unreachable the server will not start.


Require authentication to create secrets​

Add --require-auth to prevent unauthenticated users from creating secrets. They will see a Sign in prompt on the home page and the upload page. Secret retrieval links continue to work without authentication.

yopass-server \
--license-key "your-license-key" \
--oidc-issuer "https://accounts.google.com" \
--oidc-client-id "123456789-abc.apps.googleusercontent.com" \
--oidc-client-secret "GOCSPX-…" \
--oidc-redirect-url "https://yopass.example.com/auth/callback" \
--require-auth

Tip: Combine --require-auth with a --read-only public instance to create a two-tier deployment:

InstanceFlagsPurpose
Internal--require-authEmployees create secrets after signing in
Public--read-onlyAnyone can open a secret link

Both instances share the same database (Memcached or Redis).

Require authentication for everything​

Add --require-auth-all instead when recipients must sign in too. It implies --require-auth, and it also gates opening, deleting and prefetching secrets and files, checking read receipts, and managing secret requests (fetching the answer, revoking, rotating the key).

Answering a secret request stays open, so a responder without an account can still use a request link. That covers loading the request (GET /request/{id}) and submitting the answer (POST /request/{id}/secret).

Signed-out visitors see a Sign in prompt instead of the page. --oidc-allowed-domains applies to every gated operation. API tokens pass the same gates.

When the license expires, new sign-ins stop but existing sessions keep working. Signed-out visitors, including requesters collecting an answer, cannot open anything gated until the license is renewed. The gate stays closed rather than dropping protection.

Set the flag on every instance that serves the same database. A --read-only replica started without it still serves secrets to signed-out visitors.


Restricting by email domain​

Use --oidc-allowed-domains to restrict OIDC logins to users whose email address belongs to one of the specified domains. Users from other domains receive 403 Forbidden at the login callback. Domain restrictions are also checked for existing sessions on authenticated creation and access to authentication-protected secrets.

yopass-server \
--require-auth \
--oidc-allowed-domains "corp.example.com,example.com" \
# … other OIDC flags
  • Multiple domains can be specified as a comma-separated list.
  • The check is case-insensitive (Example.COM matches example.com).
  • Public secrets remain accessible with their secret links. Authentication-protected retrieval and deletion enforce the domain restriction.
  • Domain restrictions apply to OIDC login even without --require-auth. That flag separately requires authentication for creation.

Machine-to-machine API tokens​

--require-auth gates secret creation on the interactive OIDC browser flow, which backend services and automation cannot complete. Use --api-token to give such clients a static bearer token instead:

# Generate a strong secret (minimum 16 characters enforced)
openssl rand -hex 32

yopass-server \
--require-auth \
--api-token "cmdb:4f6a…9c2e" \
# … other OIDC flags

Multiple tokens are configured as a comma-separated list (cmdb:secret1,ops:secret2) or via the API_TOKEN environment variable. Each token has a name so audit logs record which service acted: creations authenticated by a token are attributed as service:<name> (e.g. service:cmdb).

The client sends the secret in the Authorization header:

curl https://yopass.example.com/create/secret \
-H "Authorization: Bearer 4f6a…9c2e" \
-H "Content-Type: application/json" \
-d '{"message":"-----BEGIN PGP MESSAGE-----…","expiration":3600,"one_time":true}'

Notes:

  • API tokens grant access to the creation endpoints only (/create/secret, /create/file, and /request), plus the routes --require-auth-all gates when that flag is set. Retrieving a secret marked require authentication still demands an interactive session.
  • Tokens are service accounts, so --oidc-allowed-domains does not apply to them.
  • --api-token requires --require-auth (or --require-auth-all); without it the creation endpoints are open and the flag is rejected at startup.
  • Treat token secrets like passwords: pass them via the API_TOKEN environment variable or a config file rather than command-line flags where possible, and rotate them by restarting with a new value.

Multi-instance deployments​

Session cookies are signed and encrypted with keys generated randomly at startup. This means sessions created by one instance cannot be validated by another — users will be logged out whenever a request hits a different server.

To share sessions across instances, generate a fixed 64-byte key and set it on every instance:

# Generate once and store securely
openssl rand -hex 64
# → e.g. 3f2a1b…c9d8e7 (128 hex characters)

Then pass it to every instance:

yopass-server \
--oidc-session-key "3f2a1b…c9d8e7" \
# … other OIDC flags

Or as an environment variable:

OIDC_SESSION_KEY=3f2a1b…c9d8e7 yopass-server …

Keep this value secret. Treat it like a password — rotate it if it is ever exposed (all active sessions will be invalidated when it changes, and pending restricted secrets can no longer be opened). An empty key uses ephemeral per-instance keys; a nonempty key must be exactly 128 hexadecimal characters or the server will refuse to start.


Docker Compose example​

services:
yopass:
image: jhaals/yopass:latest
ports:
- "1337:1337"
environment:
DATABASE: redis
REDIS: redis://valkey:6379/0
LICENSE_KEY: your-license-key
OIDC_ISSUER: https://accounts.google.com
OIDC_CLIENT_ID: 123456789-abc.apps.googleusercontent.com
OIDC_CLIENT_SECRET: GOCSPX-…
OIDC_REDIRECT_URL: https://yopass.example.com/auth/callback
REQUIRE_AUTH: "true"
OIDC_ALLOWED_DOMAINS: example.com # optional: comma-separated list of allowed email domains
OIDC_SESSION_KEY: 3f2a1b…c9d8e7 # required for replicated deployments
depends_on:
- valkey

valkey:
image: valkey/valkey:8-alpine
command: valkey-server --save "" --appendonly no

Other OIDC providers​

Use a provider that implements OpenID Connect Discovery and supplies subject and email claims through UserInfo. By default, it must also supply email_verified: true; see email verification. Set --oidc-issuer to the provider's issuer URL.

Session cookies are ignored on API requests initiated by foreign origins and on GET navigations. The bundled frontend uses fetch requests; split-origin frontends must send an Origin matching --frontend-url. Direct browser navigation to an authentication-protected secret/file API URL returns 401; use the frontend share link instead. CLI clients without browser metadata and API-token authentication remain supported.

Over HTTPS the session cookie is Secure and named __Host-yopass_session, and the sign-in flow's cookies carry the same prefix. Browsers only accept the __Host- prefix from the host itself, so another host of the same site (wiki.example.com next to yopass.example.com) cannot set these cookies for the user's browser, and cookies under the bare names are ignored. Behind a TLS-terminating reverse proxy the session cookie's prefix depends on X-Forwarded-Proto: https; without it, and over plain HTTP, it keeps the bare name.

Fetch Metadata normally requires HTTPS. Requests without both Origin and Fetch Metadata remain accepted for non-browser compatibility. Keep --prefetch-secret=true for the reveal confirmation on one-time frontend links; with it disabled, navigating to a frontend link intentionally retrieves the secret automatically. Origin checks cannot prevent that frontend-initiated action.