Configure phone authentication
In the Jupiter Dashboard, open Auth → Authentication Methods, enable Phone, and configure your phone provider.
Sign up and send the verification code
Create the phone identity by calling signInWithPhone with createIfNotExists enabled. Jupiter sends a verification code through the configured phone provider. The optional attributes object stores additional user metadata.
const result = await client.auth.signInWithPhone({ phone: '+15551234567', createIfNotExists: true, attributes: { name: 'Ada Lovelace' } }) if (result.error) { throw result.error}Confirm sign-up
Pass the phone number and the verification code to signInConfirm. A successful confirmation verifies the phone number, signs the user in, and returns the user and session.
const result = await client.auth.signInConfirm({ phone: '+15551234567', token: verificationCode}) if (result.error) { throw result.error} console.log(result.data.user)console.log(result.data.session)Set the password
After confirmation has returned an authenticated session, set the password for the current user. The phone number and password can then be used for future sign-ins.
const result = await client.auth.updateUserPassword({ new_password: 'password123'}) if (result.error) { throw result.error} console.log(result.data.user)Sign in
Use signInWithPhoneAndPassword for an existing user. A successful sign-in returns the user and session, and the client stores the session for subsequent authenticated requests.
const result = await client.auth.signInWithPhoneAndPassword({ phone: '+15551234567', password: 'password123' }) if (result.error) { throw result.error} console.log(result.data.user)console.log(result.data.session)