Skip to content

Commit 5125476

Browse files
committed
tweak jwt docs
1 parent 94e2d96 commit 5125476

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

docs/apikeys.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,29 @@ Revoking a key takes effect immediately and cannot be reversed. Requests using t
103103

104104
Removing a team member does not revoke keys they created. Review and revoke their keys separately when their access changes.
105105

106+
## Root keys
107+
108+
<Warning>
109+
Root keys are legacy, and are likely to be deprecated in the future. We recommend against using them.
110+
</Warning>
111+
112+
Each environment has a single legacy root key. It can be regenerated, which creates a new value immediately. The previous root key remains valid for 24 hours so you can update services without downtime, then stops authenticating.
113+
114+
Public access tokens signed with the previous root key remain valid until the earlier of their own expiration and the end of the 24-hour grace period.
115+
106116
## Create public access tokens
107117

108-
Keys can create scoped [Public Access Tokens](/realtime/auth) without receiving the environment's root key. Use `@trigger.dev/sdk` version 4.5.8 or later with keys.
118+
API keys can be used create scoped [Public Access Tokens](/realtime/auth) using `auth.createPublicToken()`.
109119

110-
When a key calls `auth.createPublicToken()`:
120+
In order to do so with the newer non-root keys, you must use `@trigger.dev/sdk` version 4.5.8 or later. Creating public tokens with non-root keys has the following restrictions:
111121

112122
- The token must request at least one scope.
113123
- Its scopes cannot exceed the key's access.
114-
- It expires after 15 minutes by default.
115124
- Its expiration cannot exceed 30 days.
116-
- A numeric `expirationTime` is a Unix timestamp in seconds.
117125

118-
Revoking or expiring a key does not revoke tokens it already created. Those tokens remain valid until their own expiration, unless the environment's root key is regenerated first.
126+
<Note>
127+
Revoking or expiring an API key does not revoke tokens it already created. Those tokens remain valid until their own expiration, unless the environment's root key is regenerated.
128+
</Note>
119129

120130
## Target Preview and Development branches
121131

@@ -128,16 +138,6 @@ TRIGGER_PREVIEW_BRANCH="feature/new-checkout"
128138

129139
The SDK sends the branch automatically. When calling the API directly, send the same value in the `x-trigger-branch` header.
130140

131-
## Root keys
132-
133-
<Warning>
134-
Root keys are legacy, and are likely to be deprecated in the future. We recommend against using them.
135-
</Warning>
136-
137-
Each environment has a single legacy root key. It can be regenerated, which creates a new value immediately. The previous root key remains valid for 24 hours so you can update services without downtime, then stops authenticating.
138-
139-
Public access tokens signed with the previous root key remain valid until the earlier of their own expiration and the end of the 24-hour grace period.
140-
141141
## Self-hosting
142142

143143
Self-hosted installations support multiple keys with **No restrictions**. The restricted access presets are available in Trigger.dev Cloud.

docs/realtime/auth.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const publicToken = await auth.createPublicToken({
131131
- If `expirationTime` is a number, it will be treated as a Unix timestamp in **seconds**
132132
- If `expirationTime` is a `Date`, it will be treated as a date
133133

134-
The expiration cannot be more than 30 days from now.
134+
When using non-root API keys (recommended), the expiration cannot be more than 30 days in the future.
135135

136136
The format used for a time span is the same as the [jose package](https://github.com/panva/jose), which is a number followed by a unit. Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins", "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year", "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an alias for a year. If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets subtracted from the current unix timestamp. A "from now" suffix can also be used for readability when adding to the current unix timestamp.
137137

0 commit comments

Comments
 (0)