MonoCloud Authentication SDK
    Preparing search index...
    • useAuth() is a client-side hook that exposes the current authentication state and actions provided by MonoCloudAuthProvider.

      Returns MonoCloudAuth

      The current MonoCloudAuth.

      "use client";

      import { useAuth } from "@monocloud/auth-react";

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

      if (isLoading) {
      return <>Loading...</>;
      }

      if (!isAuthenticated) {
      return <>Not signed in</>;
      }

      return <>User Id: {user?.sub}</>;
      }
      "use client";

      import { useAuth } from "@monocloud/auth-react";

      export default function Account() {
      const { signOut, refetchUserInfo } = useAuth();

      return (
      <>
      <button onClick={() => refetchUserInfo()}>Refresh profile</button>
      <button onClick={() => signOut()}>Sign out</button>
      </>
      );
      }