Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt

Use this file to discover all available pages before exploring further.

TempAccessToken is a short-lived, single-use JWT backing record used to authenticate guest OAuth connector install flows. It is created by TempTokenService.generateTempToken() when the API issues a signed 15-minute connector-access URL and is consumed (marked used) by TempTokenService.validateAndConsume() during the OAuth callback. The table acts as a replay-prevention store: a token is valid only while expires_at > now() and used_at IS NULL. It has no workspace foreign key, no soft-delete column, and no user-editable fields β€” it is entirely system-managed.
NamingValue
ObjectTempAccessToken
Resource type (JSON:API type)temp_access_token
Collection / records rootβ€” (not a records root)
REST base/v1/temp-access-tokens
Entity classTempAccessToken
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

OperationMethod & pathStatus
ListGET /v1/temp-access-tokens🟑 Planned
RetrieveGET /v1/temp-access-tokens/{id}🟑 Planned
CreatePOST /v1/temp-access-tokens🟑 Planned
UpdatePATCH /v1/temp-access-tokens/{id}🟑 Planned
DeleteDELETE /v1/temp-access-tokens/{id}🟑 Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
jtiuuid (PK) πŸ”’ systemβœ… YesPRIMARY KEY; set by service via crypto.randomUUID() β€” not a database-generated defaultAny valid UUID v4JWT ID. Serves as both the database primary key and the jti claim embedded in the signed JWT. Used to look up and validate the token during verify and consume operations.
temp_access_token_iduuid πŸ”’ systemβœ… YesDEFAULT gen_random_uuid(); NOT NULL; added in Migration20260128100000Any valid UUID v4Public-facing stable identifier for the token record. Returned to callers as the resource id in API responses. Generated at row-insert time by the database.
expires_attimestamptz πŸ”’ systemβœ… YesNOT NULL; set to now() + 15 minutes at creation by TempTokenServiceFuture timestamp at creation; past timestamp marks expiryAbsolute expiry timestamp. The repository’s findValidByJti query filters expires_at > now(). Tokens past this timestamp are treated as invalid regardless of used_at.
used_attimestamptz πŸ”’ systemβšͺ NoNULLABLE; set once by TempAccessTokenRepository.markAsUsed() on first successful consumptionnull (unused) or a single timestamptz value (consumed)Consumption timestamp. NULL means the token has not yet been used. Once set, findValidByJti will no longer return this row, enforcing single-use semantics.
created_attimestamptz πŸ”’ systemβœ… YesNOT NULL; set by @Property({ onCreate: () => new Date() }) in entity classTimestamp at row creationCreation timestamp, set by the MikroORM onCreate hook when the entity is first persisted. There is no updated_at column on this entity.

System-computed

  • temp_access_token_id β€” generated by the database via DEFAULT gen_random_uuid() at INSERT time (Migration20260128100000).
  • jti β€” set by the service layer using crypto.randomUUID() before persist; also embedded as the jti claim in the HS256-signed JWT returned to callers.
  • expires_at β€” computed by TempTokenService as Date.now() + 15 minutes (TOKEN_EXPIRY = 15 * 60 * 1000 ms) at generation time.
  • created_at β€” set by MikroORM onCreate hook (no database DEFAULT; application-side timestamp).
  • used_at β€” stamped by TempAccessTokenRepository.markAsUsed() exactly once upon successful validateAndConsume(). Never reset or cleared.
  • Single-use enforcement β€” findValidByJti combines three predicates: jti match + expires_at > now() + used_at IS NULL. All three must hold for the token to be considered valid.

Example

{
  "data": {
    "type": "temp_access_token",
    "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "attributes": {
      "temp_access_token_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "expires_at": "2026-06-02T15:45:00.000Z",
      "used_at": null,
      "created_at": "2026-06-02T15:30:00.000Z"
    }
  }
}
Source: apps/api/src/database/entities/TempAccessToken.ts Β· domain: platform Β· tier: Platform