Authenticates a customer with email/password and returns a JWT token
JavaScript
import { createSpreeClient } from '@spree/sdk' const client = createSpreeClient({ baseUrl: 'https://your-store.com', publishableKey: '<api-key>', }) const auth = await client.store.auth.login({ email: 'customer@example.com', password: 'password123', })
{ "token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImU3NmVjMGNiLTQ4M2YtNGIxZS1hMzI4LWEyNmM3MjEzZDZmYSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzcyNjY5ODA1fQ.NdHVrcagM6ZhS6uZzyyBU3Qz1yyasS3OEjEY5epIlZA", "user": { "id": "cus_UkLWZg9DAJ", "email": "test@example.com", "first_name": "Gaylord", "last_name": "Abbott", "created_at": "2026-03-04T23:16:45.224Z", "updated_at": "2026-03-04T23:16:45.224Z", "addresses": [], "default_billing_address": null, "default_shipping_address": null } }
Publishable API key for store access
"customer@example.com"
"password123"
Authentication provider (default: email)
"email"
login successful
JWT access token
Show child attributes
Was this page helpful?