Skip to main content
POST
/
api
/
v3
/
store
/
auth
/
login
Spree SDK
import { createClient } from '@spree/sdk'

const client = createClient({
  baseUrl: 'https://your-store.com',
  publishableKey: '<api-key>',
})

const auth = await client.auth.login({
  email: 'customer@example.com',
  password: 'password123',
})
{
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjkxOGY5MzI4LWI0YzctNDU5Yi1iZTczLTIxMzMwZDhhMmM5YSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0NzAxODQ4fQ.cuuj2Oi6xGSBeNEYjr91DrFNQrWTvyTaTHTbXDhdeOQ",
  "refresh_token": "YGoDXXid6KGaL59iez28EoWL",
  "user": {
    "id": "cus_UkLWZg9DAJ",
    "email": "test@example.com",
    "first_name": "Jolynn",
    "last_name": "Stiedemann",
    "phone": null,
    "accepts_email_marketing": false,
    "available_store_credit_total": "0",
    "display_available_store_credit_total": "$0.00",
    "addresses": [],
    "default_billing_address": null,
    "default_shipping_address": null
  }
}

Authorizations

x-spree-api-key
string
header
required

Publishable API key for store access

Headers

x-spree-api-key
string
required

Body

application/json
email
string<email>
required
Example:

"customer@example.com"

password
string
required
Example:

"password123"

provider
string

Authentication provider (default: email)

Example:

"email"

Response

login successful

token
string
required

JWT access token

refresh_token
string
required

Refresh token for obtaining new access tokens

user
object
required