Customer Tokens

We provide a basic /tokens endpoint that allows you authenticate customers by email and password so you can easily allow customers to manage their addresses or get orders by customer.

The customer token object

Attribute

Type

Description

id

string

The unique identifier for this token

type

string

The type represents the object being returned

customer_id

string

The ID of the customer from which the token is generated

token

string

The JSON Web Token to be used for other endpoints

expires

timestamp

The epoch time that this token expires at. It will be 24 hours from the moment the token is generated.

Generate a token

POST https://api.moltin.com/v2/customers/tokens

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API

Request Body

NameTypeDescription

password

string

The customer password

email

string

The customer email

type

string

This must be token

{
  "data": {
    "type": "token",
    "id": "36f05940-0d38-411a-8909-3aea58bc1f09",
    "customer_id": "79cc0486-bbdf-491b-a0a2-722383b6288b",
    "token": "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiI3OWNjMDQ4Ni1iYmRmLTQ5MWItYTBhMi03MjIzODNiNjI4OGIiLCJuYW1lIjoiUm9uIFN3YW5zb24iLCJleHAiOjE1MTA2ODQyMDAsImlhdCI6MTUxMDU5NzgwMCwianRpIjoiMzZmMDU5NDAtMGQzOC00MTFhLTg5MDktM2FlYTU4YmMxZjA5In0=.ea948e346d0683803aa4a2c09441bcbf7c79bd9234bed2ce8456ab3af257ea9f",
    "expires": 1510684200
  }
}
curl -X POST https://api.moltin.com/v2/customers/tokens \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
        "data":{
          "type": "token",
          "email": "ron@swanson.com",
          "password": "mysecretpassword"
        }
     }'

Using a token

You can use a X-Moltin-Customer-Token header with the following endpoints. They're available implicitly for you to read, create and update various resources.

pageGet a CustomerpageUpdate a CustomerpageGet Customer AddressespageGet an AddresspageCreate an AddresspageUpdate an AddresspageGet all OrderspageGet an Order

Last updated