How do i set values when using internalAdapter.createSession("uid", ctx);

I am creating sessions manually through a custom plugin for cases where I have guest users. I want to use the following method: const session = await ctx.context.internalAdapter.createSession(user_id, ctx); But i am not sure how to set some of the session fields? I have tried the below but this doesnt work:
ctx.body = { guest: true } // guest is an additional field i have
ctx.body = { guest: true } // guest is an additional field i have
Any suggestions?
1 Reply
GreggOD
GreggODOP4mo ago
You do this by using the overrides param:
const session = await ctx.context.internalAdapter.createSession(user_id.toString(), ctx, false, {
guest: true
});
const session = await ctx.context.internalAdapter.createSession(user_id.toString(), ctx, false, {
guest: true
});

Did you find this page helpful?