how do i protect route handlers with nextauth as well as get session data in those routes
Unanswered
English Lop posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
English LopOP
all in title, im very confused
2 Replies
![Avatar](https://cdn.discordapp.com/avatars/410884067308077056/510ed16b4d728aee289fd6f3c95c9cda.webp?size=256)
SahLozk
const session = await getServerSession(authOptions);
const role = session?.user.role;
const token = session?.user.token;
and
const { data: session } = useSession();
const role = session?.user.role;
const token = session?.user.token;