Pocket ID Documentation
repository·main·Indexed 26 days ago
https://github.com/pocket-id/pocket-idPocket ID is an OIDC Certified™ and OAuth 2.0 provider focusing on passkey-only authentication for a passwordless login experience. It is designed for securing self-hosted services and applications, with recommended deployment via Docker and Docker Compose using the pocketid/pocket-id:v2 image.
What's inside Pocket ID
- Pocket ID is an OpenID Connect (OIDC) Certified™ and OAuth 2.0 provider designed for simplicity. It allows users to sign in to applications using passkeys, eliminating the need for traditional passwords. This makes it suitable for securing self-hosted services using hardware like Yubikeys.
Set up Pocket ID using Docker
mainThe recommended and easiest way to deploy Pocket ID is via Docker. For detailed setup guides and comprehensive information, refer to the official documentation at https://docs.pocket-id.org.Run the Pocket ID server
mainThe Pocket ID backend is a CLI-driven application. When executed, it first validates the environment configuration viacommon.ValidateEnvConfig. If the configuration is valid, it proceeds to execute the command-line interface defined incmds.Execute(). Ensure all required environment variables are set before running the binary to avoid configuration errors.Deploy Pocket ID using Docker Compose
mainYou can deploy Pocket ID using a
docker-compose.ymlfile. The service uses thepocketid/pocket-id:v2image (orghcr.io/pocket-id/pocket-id:v2).Key configuration details:
- Ports: The service listens on port
1411by default. The host port is mapped to1411. - Persistence: Data is persisted by mounting a local
./datadirectory to/app/datainside the container. - Environment Variables: Configuration is managed via an
.envfile. - Healthcheck: An optional healthcheck is provided using the
/app/pocket-id healthcheckcommand.
services: pocket-id: image: pocketid/pocket-id:v2 # or ghcr.io/pocket-id/pocket-id:v2 restart: unless-stopped env_file: .env ports: - 1411:1411 volumes: - "./data:/app/data" # Optional healthcheck healthcheck: test: [ "CMD", "/app/pocket-id", "healthcheck" ] interval: 1m30s timeout: 5s retries: 2 start_period: 10s- Ports: The service listens on port
Interact with the OIDC Client interface
mainThe
Clienttype provides methods to retrieve OIDC configuration and metadata required for authentication flows. It wraps amodel.OidcClientand provides specific implementations for scopes, grant types, and redirect URIs compatible with thefositelibrary.Key methods include:
GetID(): Returns the unique client identifier.GetHashedSecret(): Returns the client secret as a byte slice.GetRedirectURIs(): Returns the list of allowed callback URLs.GetGrantTypes(): Returns supported grant types (Authorization Code, Refresh Token, and Device Code are always included; Client Credentials is included only if the client is not public).GetScopes(): Returns the standard OIDC scopes (openid,profile,email,groups,offline_access) plus any additionalapiScopesconfigured for the client.GetAudience(): Returns the client ID and any additionalapiAudiencesconfigured.IsPublic(): Indicates if the client is a public client (no secret required).
Retrieve OIDC scopes from a Client
mainThe
GetScopes()method returns the set of scopes available to the client. It always includes the following standard OIDC scopes:openidprofileemailgroupsoffline_access
Any additional scopes configured in the client's
apiScopesfield are appended to this list.Retrieve supported OIDC grant types from a Client
mainThe
GetGrantTypes()method returns the allowed OAuth2/OIDC grant types for a specific client.- Always included:
authorization_code,refresh_token, anddevice_code. - Conditional:
client_credentialsis only included ifIsPublic()returnsfalse(i.e., for confidential clients).
- Always included:
Retrieve OIDC audience from a Client
mainThe
GetAudience()method returns the audience identifiers for the token. The returned list includes:- The client's own
ID. - Any additional identifiers listed in the client's
apiAudiencesfield.
- The client's own