useLogin()
useLogin function serves for authentication, retrieving details like whether the current user is authenticated, their information, and also includes the functionality for logging out.
Example:
import { useLogin } from '@magicjs.dev/frontend';
const { current, logout } = useLogin();
return (
<div>
<button onClick={logout}>Logout</button>
{current.isAuthenticated ? (
<div>User is Authenticated</div>
) : (
<div>User is not Authenticated</div>
)}
</div>
);
Last updated