import { useAuth } from '@kerne/react';
function LoginForm() {
const { login } = useAuth();
const handleSubmit = async (email: string, password: string) => {
try {
await login({ email, password });
} catch (err) {
// see Errors below
}
};
return null; // your form
}
login() resolves to the raw token-exchange response - { token, refresh_token, user: { id, email, role }, expires_at }, the minimal claim set, not the full profile. Read the full user (with first_name, avatar, email_verified, …) from useAuth().user instead, which the SDK hydrates right after login - see Session.function Welcome() {
const { user, isAuthenticated } = useAuth();
if (!isAuthenticated) return null;
return <p>Welcome back, {user?.email}</p>;
}
Errors
| Code | Meaning |
|---|---|
K1005 | Invalid email or password. |
K3002 | Account is deactivated (is_active: false). |

