Skip to content

Add missing imports to overview.mdx #1731

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
Feb 25, 2025
Merged
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
18 changes: 18 additions & 0 deletions docs/frontend/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ You can use our [React hooks](/frontend/react-hooks) in your frontend applicatio
To create a Public Access Token, you can use the `auth.createPublicToken` function in your **backend** code:

```tsx
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken(); // 👈 this public access token has no permissions, so is pretty useless!
```

Expand All @@ -19,6 +21,8 @@ const publicToken = await auth.createPublicToken(); // 👈 this public access t
By default a Public Access Token has no permissions. You must specify the scopes you need when creating a Public Access Token:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
scopes: {
read: {
Expand All @@ -31,6 +35,8 @@ const publicToken = await auth.createPublicToken({
This will allow the token to read all runs, which is probably not what you want. You can specify only certain runs by passing an array of run IDs:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
scopes: {
read: {
Expand All @@ -43,6 +49,8 @@ const publicToken = await auth.createPublicToken({
You can scope the token to only read certain tasks:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
scopes: {
read: {
Expand All @@ -55,6 +63,8 @@ const publicToken = await auth.createPublicToken({
Or tags:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
scopes: {
read: {
Expand All @@ -67,6 +77,8 @@ const publicToken = await auth.createPublicToken({
Or a specific batch of runs:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
scopes: {
read: {
Expand All @@ -79,6 +91,8 @@ const publicToken = await auth.createPublicToken({
You can also combine scopes. For example, to read runs with specific tags and for specific tasks:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
scopes: {
read: {
Expand All @@ -94,6 +108,8 @@ const publicToken = await auth.createPublicToken({
By default, Public Access Token's expire after 15 minutes. You can specify a different expiration time when creating a Public Access Token:

```ts
import { auth } from "@trigger.dev/sdk/v3";

const publicToken = await auth.createPublicToken({
expirationTime: "1hr",
});
Expand All @@ -120,6 +136,8 @@ console.log(handle.publicAccessToken);
By default, tokens returned from the `trigger` function expire after 15 minutes and have a read scope for that specific run. You can customize the expiration of the auto-generated tokens by passing a `publicTokenOptions` object to the `trigger` function:

```ts
import { tasks } from "@trigger.dev/sdk/v3";

const handle = await tasks.trigger(
"my-task",
{ some: "data" },
Expand Down