File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import UserMetadata from "../../recipe/usermetadata";
26
26
import { BooleanClaim , PrimitiveClaim , SessionClaim } from "../../recipe/session/claims" ;
27
27
import UserRoles from "../../recipe/userroles" ;
28
28
import Dashboard from "../../recipe/dashboard" ;
29
+ import JWT from "../../recipe/jwt" ;
29
30
30
31
UserRoles . init ( {
31
32
override : {
@@ -1371,3 +1372,29 @@ Supertokens.init({
1371
1372
Dashboard . init ( {
1372
1373
apiKey : "" ,
1373
1374
} ) ;
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments