Skip to main content
Sign-up, login, magic links and token refreshes all return the same session:
token is the access token, valid until expires_at. user is a minimal summary; get the full profile with users.get(). In the examples, asUser is kerne.withToken(accessToken), a client that acts as the signed-in user.

Sign up

Whether it succeeds depends on your registration mode. On an invite-only project, add invitationToken or invitationCode.

Log in

Handle K1005 (wrong email or password), K1011 (email not verified, when your project requires it) and K3002 (account deactivated).
startPasswordless() always resolves, whether or not the email has an account. It creates the account when your registration mode allows it; on an invite-only project, pass { invitationToken } or { invitationCode } as a second argument. The link works once, for 15 minutes. Turn magic links on in Settings → Authentication.

Tokens

Pass the refresh_token from the last session, not the access token: an access token is rejected. login(), refreshToken() and loginWithMagicLink() all call auth.token(), which accepts grant_type: 'password' | 'refresh_token' | 'magic_link' directly.

Email verification

The verification email contains a code, a link, or both, depending on your project settings.
Calling sendVerificationEmail() again on the same client within 60 seconds throws a RateLimitError. When needsTokenRefresh is true, refresh the session so the token’s email_verified claim is up to date. verifyEmail(token) is an older single-token variant, kept for compatibility.

Passwords

Account activation

An account created for someone else, or by a magic-link sign-up, is activated from an emailed link:
getActivationContext() doesn’t use up the token. completeActivation() signs the user in. To deactivate the signed-in user’s own account, call asUser.auth.requestAccountDeletion(). Their data is kept.

Auth config

Your project’s public sign-in settings, for building your own sign-in screens. No secret key needed.
Render your screens from it: the password form only if enable_credentials, the magic link option only if enable_magic_link, and password rules from password_policy, which is what the server enforces. portal_url is your hosted sign-in portal, and post_auth_redirect_url is where it sends users back. oauth_providers is always empty: social sign-in isn’t available. The response is cached for up to an hour.

Session handoff

Your hosted portal runs on its own domain, so a session created there isn’t visible to your app. A handoff code carries it across without putting a token in a URL:
A code works once, for 60 seconds. @kerne/react does both steps for you: see Session handoff.