Skip to content

Triggering docs and adding options to all trigger hooks #1528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nine-vans-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/react-hooks": patch
---

Add trigger options to all trigger hooks
29 changes: 0 additions & 29 deletions docs/frontend/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,35 +89,6 @@ const publicToken = await auth.createPublicToken({
});
```

### Write scopes

You can also specify write scopes, which is required for triggering tasks from your frontend application:

```ts
const publicToken = await auth.createPublicToken({
scopes: {
write: {
tasks: ["my-task-1", "my-task-2"],
},
},
});
```

This will allow the token to trigger the specified tasks. `tasks` is the only write scope available at the moment.

We **strongly** recommend creating short-lived tokens for write scopes, as they can be used to trigger tasks from your frontend application:

```ts
const publicToken = await auth.createPublicToken({
scopes: {
write: {
tasks: ["my-task-1"], // ✅ this token can trigger this task
},
},
expirationTime: "1m", // ✅ this token will expire after 1 minute
});
```

### Expiration

By default, Public Access Token's expire after 15 minutes. You can specify a different expiration time when creating a Public Access Token:
Expand Down
Loading
Loading