Skip to content

Commit 46498bb

Browse files
committed
Public access token test task
1 parent 351ee53 commit 46498bb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { auth, batch, logger, runs, task, tasks, timeout, wait } from "@trigger.dev/sdk";
2+
3+
export const publicAccessTokensTask = task({
4+
id: "public-access-tokens",
5+
run: async (payload: any, { ctx }) => {
6+
const token = await auth.createPublicToken({
7+
scopes: {
8+
read: {
9+
runs: [ctx.run.id],
10+
},
11+
},
12+
});
13+
14+
logger.info("Token", { token });
15+
16+
await auth.withAuth({ accessToken: token }, async () => {
17+
const run = await runs.retrieve(ctx.run.id);
18+
logger.info("Run", { run });
19+
});
20+
},
21+
});

0 commit comments

Comments
 (0)