API: Obtain JWT / Sign In as a Customer
Prerequisites
In order to perform the sign up of a customer, you should have read our introduction on how our API is built and what basic concepts have been applied:
Variables
Throughout our tutorials, we will use Variables which are also part of our Postman collections:
{{API_URL_SHOP}}
: this covers the whole URL of the REST-API including the suffix for “shop”-related endpoints
The request: obtain JWT
Method
POST
Endpoint
POST {{API_URL_SHOP}}/authentication-token
Request Body
Request Code (Success)
200
Response Body
{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ.....", "customer": "/api/v2/shop/customers/76" }
Error Response Codes
401 - Unauthorized
Restrictions:
Emails needs to be unique across the whole instance of your store or marketplace.
Certain validators are applied on
$firstName
and$lastName
, which can be found here (TODO: link).
Good to know
The response of a successful authentication contains the JSON WebToken (JWT) and the associated CustomerIRI of the authenticated user. The JWT must be used for any further authentication for the API endpoints that require valid user authentication, while the customerIRI is for all Endpoints that require a reference to that particular user.
In case of any errors like invalid credentials, un-verified or locked user account or even when the user does not exists at all, a 401 unauthorized
will be returned.
Last updated