Getting customer token and using it




I am using the sdk and would like to log a user in after I have requested the customer token is it up to me to handle adding auth headers and making requests because as I understand it the SDK should handle storing the token for use when needed?


Hey @joe :wave:

Could you elaborate on your use case a little further? Are you trying to retrieve customer details or customer orders?

Using the JS SDK you can generate a customer JWT:

const { data: { token } } = await Moltin.Customers.Token(email, password)

Then with the returned token, get orders for that customer:

await Moltin.Orders.All(token)


I want to let the customer login and retrieve their orders


The example above will take care of that for you :smile:


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