Redirects the user to the sign-out flow.
App Router only. Intended for use in Server Components, Route Handlers, and Server Actions.
This helper performs a server-side redirect to the configured sign-out route. Execution does not continue after the redirect is triggered.
| Parameter | Type | Description |
|---|---|---|
options? | RedirectToSignOutOptions | Optional configuration for the redirect, such as postLogoutRedirectUri or additional sign-out parameters. |
Promise<void>
Never resolves. Triggers a redirect to the sign-out flow.
import { getSession, redirectToSignOut } from "@monocloud/auth-nextjs";
export default async function Page() {
const session = await getSession();
// Example: Force sign-out if a specific condition is met (e.g., account suspended)
if (session?.user.isSuspended) {
await redirectToSignOut();
}
return <>Welcome User</>;
}