Skip to content

Commit d07f864

Browse files
committed
adds to ts playground
1 parent a8760b9 commit d07f864

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/with-typescript/index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import UserMetadata from "../../recipe/usermetadata";
2626
import { BooleanClaim, PrimitiveClaim, SessionClaim } from "../../recipe/session/claims";
2727
import UserRoles from "../../recipe/userroles";
2828
import Dashboard from "../../recipe/dashboard";
29+
import JWT from "../../recipe/jwt";
2930

3031
UserRoles.init({
3132
override: {
@@ -1371,3 +1372,29 @@ Supertokens.init({
13711372
Dashboard.init({
13721373
apiKey: "",
13731374
});
1375+
1376+
Supertokens.init({
1377+
appInfo: {
1378+
apiDomain: "..",
1379+
appName: "..",
1380+
websiteDomain: "..",
1381+
},
1382+
recipeList: [JWT.init()],
1383+
});
1384+
1385+
app.post("/create-anonymous-session", async (req, res) => {
1386+
let token = await JWT.createJWT(
1387+
{
1388+
sub: "<Generate random ID>",
1389+
isAnonymous: true,
1390+
// other info...
1391+
},
1392+
3153600000
1393+
); // 100 years validity.
1394+
if (token.status !== "OK") {
1395+
throw new Error("Should never come here");
1396+
}
1397+
res.json({
1398+
token: token.jwt,
1399+
});
1400+
});

0 commit comments

Comments
 (0)