KindeK
Kinde13mo ago
3 replies
bazar21

What is the proper way to test if user is authenticated?

I am using sequence below to test if a user is authenticated or not. However, this causes an async call to kinde as I understand for each isAuthenticated() for ex.

Is there a better way to handle this and obtain the authentication status?
const { getUser, isAuthenticated } = getKindeServerSession();
const authenticated = (await isAuthenticated());
const newuser = await getUser();
if (authenticated) {
const newuser = await getUser();
Was this page helpful?