Skip to content
Kapten
Esc
↑↓navigate↵open⌘Jpreview

Create a client secret

Creates a secret for the application, to start using secrets or to rotate them. Requires organization:update. Only this response holds the secret. An application holds at most 5 active secrets (409).

POST/organizations/{organizationId}/oauth-clients/{clientId}/secrets
Authorization
AuthorizationBearer token (JWT) · headerrequired

An access token issued by this service (RFC 9068), in the Authorization header as Bearer <token>.

Path parameters
organizationIdstring<uuid>required
clientIdstring<uuid>required

The client's id, the uuid in its cli_<id> client_id.

Request body
requiredapplication/json
expires_atstring<date-time>

When the secret stops authenticating the client, in the future. Without it the secret does not expire.

Responses
201

The new secret, with its value.

idstring<uuid>required
secretstring

The secret, kapten_sk_ followed by 43 base64url characters. Present only in the response that created it; it cannot be read again.

hintstringrequired

The secret's last four characters, to tell secrets apart.

created_atstring<date-time>required
expires_atstring<date-time>

When the secret stops authenticating the client; absent when it does not expire.

revoked_atstring<date-time>

Set once the secret is revoked; it then authenticates nothing.

default

The request failed.

errorstringrequired

Stable machine-readable code.

Allowed:invalid_requestunauthorizedforbiddennot_foundconflictgoneunavailableinternal
messagestringrequired

Human-readable explanation.

Request
curl -X POST 'https://auth.kapten.io/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/oauth-clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/secrets' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "expires_at": "2019-08-24T14:15:22Z"
}'
Response
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "secret": "string",
  "hint": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "revoked_at": "2019-08-24T14:15:22Z"
}

Was this page helpful?