Props for customizing the Protected component.
The children if authorized, the fallback or onGroupAccessDenied content if unauthenticated or unauthorized, or null while loading.
"use client";
import { Protected } from "@monocloud/auth-nextjs/components/client";
export default function Home() {
return (
<Protected fallback={<>Sign in to view the message.</>}>
<>This is the protected content.</>
</Protected>
);
}
"use client";
import { Protected } from "@monocloud/auth-nextjs/components/client";
export default function Home() {
return (
<Protected
groups={["admin"]}
onGroupAccessDenied={(user) => <>User {user.email} is not allowed to access admin content.</>}
>
<>Signed in as admin</>
</Protected>
);
}
"use client";
import { Protected } from "@monocloud/auth-nextjs/components/client";
export default function Home() {
return (
<Protected
groups={["admin", "billing"]}
matchAllGroups
onGroupAccessDenied={(user) => <>User {user.email} is not allowed to access billing content.</>}
>
<>Sensitive settings</>
</Protected>
);
}
<Protected>conditionally renders its children based on the user’s authentication state and (optionally) group membership.