Auth through the Jupiter client
The aggregate Jupiter client exposes authentication through client.auth. It initializes session persistence, token refresh, OAuth callback detection, and cross-tab auth events for browser applications.
import { Jupiter } from '@jupiter-cloud/sdk' const client = new Jupiter( 'https://api.jupitercloud.co', 'project-id', 'optional-team-api-key')Available authentication flows
- Email and password sign-up and sign-in
- Phone verification and phone/password sign-in
- Email magic links and email OTP
- Phone OTP
- OAuth redirects and provider ID tokens
- Anonymous sessions
- Password recovery and user-attribute confirmation
- TOTP, phone, and WebAuthn multi-factor authentication
- Identity linking and unlinking
- Session refresh, JWT verification, and auth-state subscriptions
- Server-side user and factor administration
Response handling
Auth request methods return a data and error pair by default. Check error before using the response. Set throwOnError in the client options if rejected promises are preferred.
const { data, error } = await client.auth.signInWithEmailAndPassword({ email: 'user@example.com', password: 'password123' }) if (error) { console.error(error.message)} else { console.log(data.user, data.session)}