signUp()
Signature
massi.auth.signUp(credentials: { email: string; password: string }) : Promise<{ data: Session | null; error: MassiError | null }>Example
const { data, error } = await massi.auth.signUp({ email: 'fatima@example.dz', password: 'a-good-password',})
if (error) { console.error(error.message) return}
console.log('User:', data.user.email)console.log('Token:', data.access_token)What it does
- Sends a POST to
/auth/signupwith email + password - Hashes the password server-side with bcrypt
- Inserts a row into your
auth.userstable - Returns a
Sessionwith access + refresh tokens - The SDK stores the session if
persistSessionis enabled
Response
On success:
{ data: { user: { id, email, created_at, ... }, access_token: 'eyJhbGc...', refresh_token: 'eyJhbGc...', expires_at: 1718284800, token_type: 'Bearer' }, error: null}On failure (e.g. email already exists):
{ data: null, error: { message: 'user with this email already exists', status: 409 }}Notes
- Email is normalized to lowercase before storage.
- Minimum password length is 6 characters.
- No email verification step exists yet — users are immediately active. Email verification is on the roadmap.