Skip to content

Commit f8f21ea

Browse files
committed
Updated auth
1 parent 8849168 commit f8f21ea

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

docs/realtime/auth.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ To use the Realtime API, you need to authenticate your requests with Public Acce
1010

1111
There are two types of tokens you can use with the Realtime API:
1212

13-
- **[Public Access Tokens](#public-access-tokens-for-subscribing-to-runs)** - Used to read and subscribe to run data. Can be used in both frontend and backend applications.
14-
- **[Trigger Tokens](#trigger-tokens-for-frontend-triggering-only)** - Used to trigger tasks from your frontend. These are more secure, single-use tokens that can only be used in frontend applications.
13+
- **[Public Access Tokens](#public-access-tokens-for-subscribing-to-runs)** - Used to read and subscribe to run data. Can be used in both the frontend and backend.
14+
- **[Trigger Tokens](#trigger-tokens-for-frontend-triggering-only)** - Used to trigger tasks from your frontend. These are more secure, single-use tokens that can only be used in the frontend.
1515

1616
## Public Access Tokens (for subscribing to runs)
1717

18-
Public Access Tokens are used to read and subscribe to run data. They can be used in both frontend and backend applications to subscribe to runs.
18+
Use Public Access Tokens to subscribe to runs and receive real-time updates in your frontend or backend.
1919

2020
### Creating Public Access Tokens
2121

2222
You can create a Public Access Token using the `auth.createPublicToken` function in your **backend** code:
2323

2424
```tsx
25+
// Somewhere in your backend code
2526
import { auth } from "@trigger.dev/sdk/v3";
2627

2728
const publicToken = await auth.createPublicToken(); // 👈 this public access token has no permissions, so is pretty useless!
@@ -144,7 +145,7 @@ See our [triggering documentation](/triggering) for detailed examples of how to
144145

145146
Once you have a Public Access Token, you can use it to authenticate requests to the Realtime API in both backend and frontend applications.
146147

147-
**Backend usage:** See our [backend subscription documentation](/realtime/backend/subscribe) for examples of using tokens with backend functions.
148+
**Backend usage:** See our [backend documentation](/realtime/backend) for examples of what you can do with Realtime in your backend once you have authenticated with a token.
148149

149150
**Frontend usage:** See our [React hooks documentation](/realtime/react-hooks) for examples of using tokens with frontend components.
150151

@@ -198,8 +199,6 @@ const triggerToken = await auth.createTriggerPublicToken("my-task", {
198199
});
199200
```
200201

201-
### Triggering tasks from frontend with Trigger Tokens
202-
203-
To trigger tasks from your frontend, you need to use special Trigger Tokens created in your backend. See our [React hooks triggering documentation](/realtime/react-hooks/triggering) for complete examples.
202+
### Triggering tasks from the frontend with Trigger Tokens
204203

205-
See our [React hooks documentation](/realtime/react-hooks) for more details on using hooks in your frontend application.
204+
Check out our [React hooks documentation](/realtime/react-hooks) for examples of how to use Trigger Tokens in your frontend applications.

0 commit comments

Comments
 (0)