Skip to main content

Get an Access Token

Get an Access Token

Custd APIs use OAuth2 bearer tokens issued by the self-hosted Ory Hydra stack. For local development, start the stack and use the dev helper:

just docker-up
TOKEN="$(just dev-hydra-token)"
curl -sf http://localhost:8087/api/v1/account/me \
-H "Authorization: Bearer $TOKEN"

Hydra-issued tokens are verified through JWKS. There is no local shared-secret token path.

Portable client credentials flow

Create a confidential client, then request a token:

CLIENT_ID=my-app CLIENT_SECRET=change-me \
SCOPE="events.write events.read" \
just hydra-create-client

curl -sf -u "my-app:change-me" \
-d "grant_type=client_credentials" \
-d "scope=events.write events.read" \
-d "audience=custd" \
http://localhost:4444/oauth2/token

Use the returned access_token as Authorization: Bearer <token>.