Skip to main content

Access Session Info In GraphQL Operations

GraphQL passes the context object (refer to backend setup) to your resolvers, you can use this context to set and read session information.

var resolvers = {
foo: (_: any, context: any) => {
if (context.session !== undefined) {
// Use the session object, for example context.session.getUserId()
} else {
// Session does not exist

Refer to this page to know more about the session object

Which frontend SDK do you use?
supertokens-web-js / mobile