Configure email authentication
Before using email authentication, open Auth → Authentication Methods in the Jupiter Dashboard and configure your SMTP settings. Jupiter Auth uses this configuration to deliver confirmation, sign-in, invitation, and password-recovery emails.
Sign up
signUpWithEmailAndPassword creates the user and stores attributes as user-controlled metadata. emailRedirectTo controls where confirmation links return the user. When email verification is required, the returned session remains empty until confirmation completes.
const result = await client.auth.signUpWithEmailAndPassword({ email: 'user@example.com', password: 'password123', attributes: { displayName: 'Ada' }, options: { emailRedirectTo: 'https://app.example.com/auth/callback' } }) if (result.error) { throw result.error} console.log(result.data.user)console.log(result.data.session)Confirm sign-up
Users must confirm their email address when Enforce email verification is enabled in the settings. This setting is enabled by default. When it is disabled, a successful sign-up automatically returns the user and session.
Under Templates, select the Signup Email Verification Template. With the magic-link template, the user is authenticated and confirmed after following the link. With the OTP template, call signUpConfirm with the user’s email address and verification code. It returns the user and session.
const result = await client.auth.signUpConfirm({ email: 'user@example.com', token: verificationCode}) if (result.error) { throw result.error} console.log(result.data.user)console.log(result.data.session)Sign in
signInWithEmailAndPassword authenticates an existing user, stores the returned session, and returns both the user and session. The response can also include weakPassword when the password was accepted but does not satisfy the current password policy.
const result = await client.auth.signInWithEmailAndPassword({ email: 'user@example.com', password: 'password123' }) if (result.error) { throw result.error} console.log(result.data.user)console.log(result.data.session)console.log(result.data.weakPassword)