createAuthMiddleware context.returned

i want to check user role on createAuthMiddleware hook, but returned only return basic user field like id, name, email, emailVerified, image, create and update at. no role field, how to fix this
hooks: {
after: createAuthMiddleware(async ({ path, headers, context }) => {
const returned = context.returned;
const origin = headers ? new URL(headers.get("origin") ?? "").origin : null;

if (path === "/sign-in/email") {
console.log({ returned, origin });
}
}),
},
hooks: {
after: createAuthMiddleware(async ({ path, headers, context }) => {
const returned = context.returned;
const origin = headers ? new URL(headers.get("origin") ?? "").origin : null;

if (path === "/sign-in/email") {
console.log({ returned, origin });
}
}),
},
1 Reply
Fahmi Idris
Fahmi IdrisOP19h ago
GitHub
Multiple client apps, one should only allow admins to sign in · be...
Hi guys, really liking better auth but wondering what is the best way to accomplish the following requirements: 2 separate client applications one is admin dashboard, should only allow users with a...

Did you find this page helpful?