Gate a page or component
Protect server-rendered content
Kinde · Function
isAuthenticated checks whether the current Kinde session represents an authenticated user. In a Next.js server component, call it through getKindeServerSession and await the boolean result.
In the Next.js App Router SDK, obtain the server-session helpers with getKindeServerSession, then call isAuthenticated and await its result. The function reports whether the current session represents an authenticated user; use that boolean to allow protected behavior or prompt for sign-in.
const { isAuthenticated } = getKindeServerSession();
const authenticated = await isAuthenticated();A boolean indicating whether the user is authenticated.
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export default async function Page() {
const { isAuthenticated } = getKindeServerSession();
const authenticated = await isAuthenticated();
return <p>{authenticated ? "Signed in" : "Please sign in"}</p>;
}Reads the server session and awaits the boolean authentication check.
Protect server-rendered content
Choose the appropriate access path
Inspect browser authentication state
Call getKindeServerSession, extract isAuthenticated, and await isAuthenticated(). The resulting boolean indicates whether the user is authenticated.
Follow-up: How would you use it in a client component? Use useKindeBrowserClient and read its isAuthenticated value instead of the server-session helper.
The function returns a boolean: true when the user is authenticated and false otherwise. The documented example stores that result in isUserAuthenticated.
Follow-up: What should unauthenticated requests receive? They should be redirected or shown a sign-in path rather than allowed to access protected behavior.
The server-side form is asynchronous and must be awaited. This ensures the authentication state is resolved before rendering or protecting the requested content.
Follow-up: Which client-side API exposes the equivalent state? useKindeBrowserClient returns an isAuthenticated value for client components.
getKindeServerSessionuseKindeBrowserClientgetUsergetPermission