How to use Customer JSON Web Token

curl

#1

Hi, I’m using the customer authentication which returns me the customer_id and a JSON web token which the documentation says I should use “to make implicit requests for other endpoints”. I don’t seem to find some examples showing how to use this token when making endpoint requests. Can someone show me some examples?


#2

Hey Bica :wave:

You can use the customer JWT to retrieve orders, customer details and customer addresses.

Are you using one of our SDK libraries, or making direct API calls?


#3

Thanks for the answer. I’m making direct api calls.


#4

You need to pass the customer JWT with the headers of the request, along with the access_token from authenticating with the API.

To retrieve all orders for a specific customer:

curl -X GET https://api.moltin.com/v2/orders \
  -H "Authorization: Bearer XXXX"
  -H "X-Moltin-Customer-Token: XXXX"

To retrieve a single order for a specific customer:

curl -X GET https://api.moltin.com/v2/orders/:order_id \
  -H "Authorization: Bearer XXXX"
  -H "X-Moltin-Customer-Token: XXXX"

How to get list of orders for a single customer
#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.