File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 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";
2626import { BooleanClaim , PrimitiveClaim , SessionClaim } from "../../recipe/session/claims" ;
2727import UserRoles from "../../recipe/userroles" ;
2828import Dashboard from "../../recipe/dashboard" ;
29+ import JWT from "../../recipe/jwt" ;
2930
3031UserRoles . init ( {
3132 override : {
@@ -1371,3 +1372,29 @@ Supertokens.init({
13711372Dashboard . 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+ } ) ;
You can’t perform that action at this time.
0 commit comments