auth::tokens

Issues a namespace-scoped JWT. Requires the admin token, even when the deployment allows unauthenticated requests.

Changed on
post/auth/tokens

Request

  • Base URL
    https://api.rivet.dev
  • URL
    https://api.rivet.dev/auth/tokens
  • Auth
    • HTTP bearer
    • or API key in header x-rivet-token

Request body

namespacestring required

Name of the namespace the token is scoped to. It must exist.

durationinteger nullable

Token lifetime in seconds, from 1 to the deployment's maximum. Defaults to the deployment's configured duration.

subjectstring nullable

Opaque identifier of the end user, at most 256 UTF-8 bytes. Only used for correlation.

Example request

{
  "grants": [
    {
      "target": {
        "id": "d97pbq1nyqxw1w5qdwz0iirbqiblh2"
      }
    }
  ]
}

Response

The issued token. The response carries Cache-Control: no-store.

tokenstring required

The signed JWT.

issued_tsinteger required

When the token was issued, in Unix milliseconds.

expires_tsinteger required

When the token expires, in Unix milliseconds.

Example response

{
  "token": "eyJ..."
}

Changes

    • breaking

      removed the enum value runner of the request property //

    • breaking

      removed the enum value runner_config of the request property //

    • breaking

      the request property's min was increased to 1.00

    • breaking

      the request property's minItems was increased to 1

    • breaking

      the // request property's minItems was increased to 1

    • breaking

      added the pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ to the request property

    • info

      the endpoint scheme security rivet_token_header was added to the API

    • info

      added the new node enum value to the request property //

    • info

      added the new pool enum value to the request property //

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      endpoint added