Documentation navigation
← Back to Jupiter Auth

Get Started with Jupiter Auth

Initialize Auth for your project, configure email delivery, create your first user, and track the resulting session.

Initialize Auth for your project

In the Jupiter Console, create a new project, then select Auth for that project and initialize it

Select the Auth region where the data of your users will be stored. Jupiter uses broad regions because Auth data is automatically replicated across regional nodes within the selected geographical region for resilience and failover. The currently supported regions are US (United States) and EU (Europe).

Install the SDK

npm install @jupiter-cloud/sdk

Initialize the client

Initialize the client with the Auth base URL and the Project ID shown in the Jupiter Dashboard. Auth is available from the client.auth namespace.

import { Jupiter } from '@jupiter-cloud/sdk' const client = new Jupiter(  'https://api.jupitercloud.co',  'project-id',  'optional-team-api-key')

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.

Create a user

const result =  await client.auth.signUpWithEmailAndPassword({    email: 'user@example.com',    password: 'password123',    attributes: {      name: 'Ada Lovelace'    }  }) if (result.error) {  throw result.error} console.log(result.data.user)console.log(result.data.session)

Track the session

The callback immediately receives INITIAL_SESSION and then receives subsequent sign-in, sign-out, refresh, recovery, user-update, and MFA events.

const { data: { subscription } } =  client.auth.onAuthStateChange((event, session) => {    console.log(event, session)  }) // Call when the listener is no longer needed.subscription.unsubscribe()