MonoCloud Authentication SDK
    Preparing search index...
    • <RedirectToSignIn> is a client-side component that immediately redirects the user to the MonoCloud sign-in page when it is rendered.

      It does not render any UI.

      This component must be used inside a Client Component ("use client").

      Parameters

      Returns null

      "use client";

      import { useAuth } from "@monocloud/auth-nextjs/client";
      import { RedirectToSignIn } from "@monocloud/auth-nextjs/components/client";

      export default function Home() {
      const { isLoading, isAuthenticated } = useAuth();

      if (!isLoading && !isAuthenticated) {
      return <RedirectToSignIn />;
      }

      return <>You are signed in</>;
      }

      You can customize the authorization request by passing in props.

      "use client";

      import { useAuth } from "@monocloud/auth-nextjs/client";
      import { RedirectToSignIn } from "@monocloud/auth-nextjs/components/client";

      export default function Home() {
      const { isLoading, isAuthenticated } = useAuth();

      if (!isLoading && !isAuthenticated) {
      return (
      <RedirectToSignIn
      returnUrl="/dashboard"
      loginHint="user@example.com"
      />
      );
      }

      return <>You are signed in</>;
      }