Configure challenge delivery
Configure SMTP before sending email challenges. To send phone challenges, enable Phone and configure the phone provider under Auth → Authentication Methods.
Send an email challenge
signInWithEmail sends an email challenge. createIfNotExists controls whether Jupiter can create a user when no account exists and defaults to true.
const result = await client.auth.signInWithEmail({ email: 'user@example.com', createIfNotExists: true, options: { emailRedirectTo: 'https://app.example.com/auth/callback' }}) if (result.error) { throw result.error}Complete a magic-link sign-in
When the selected email template uses a magic link, the user completes authentication by following the link. The Auth client detects the callback URL and stores the returned session when detectSessionInUrl is enabled.
Confirm an email token
When the email contains a verification code, pass the email address and code to signInConfirm. A successful confirmation returns the user and session.
const result = await client.auth.signInConfirm({ email: 'user@example.com', token: verificationCode}) if (result.error) { throw result.error} console.log(result.data.user)console.log(result.data.session)Send and confirm a phone token
signInWithPhone sends an SMS challenge and returns the provider message identifier when one is available. Confirm the code with signInConfirm to receive the user and session.
const sendResult = await client.auth.signInWithPhone({ phone: '+15551234567', createIfNotExists: true }) if (sendResult.error) { throw sendResult.error} console.log(sendResult.data.messageId) const confirmResult = await client.auth.signInConfirm({ phone: '+15551234567', token: verificationCode}) if (confirmResult.error) { throw confirmResult.error} console.log(confirmResult.data.user)console.log(confirmResult.data.session)