XM
Members
Login Local User
Path:
1
POST https://{baseurl}/api-commerceIdentity/auth/local/login
Copied!
Allows registered users to login to your site using their own credentials (email and password). Unlike guest users, a logged-in user can save their settings, preferences, build a persistent cart, track orders, view order history, add/update wish list, and much more.
This API returns the customer details along with the JSON Web Token (JWT), which is your customer's digital signature. It defines a compact and self-contained way for securely transmitting information. This Authorization token is essential to run most of the customer-context API calls.
Headers
Content-Type : application/json
x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type : requestBody
Name : The login credentials.
Required: true

Sample Request

1
{
2
"username" : "[email protected]",
3
"password" :"ExamplePassword123!"
4
}
5
Copied!

Sample Response

HTTP Code: 200 Message: OK
Description: You will see this message when login credentials are successfully validated and the user has logged in to your site.
1
{
2
3
"_id": "5e97947d3cb8553c0e43d87f",
4
"userId": 90,
5
"roles": [
6
{
7
"id": "5de1646f8c6352091d944f1c"
8
}
9
],
10
"name": {
11
"first": "John",
12
"middle": "A",
13
"last": "Smith"
14
},
15
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlOTc5NDdkM2NiODU1M2MwZTQzZDg3ZiIsInJvbGVzIjpbeyJpZCI6IjVkZTE2NDZmOGM2MzUyMDkxZDk0NGYxYyJ9XSwiaWF0IjoxNTg2OTkyODUyLCJleHAiOjE1ODY5OTQ2NTJ9.KGGW4Ij8PpnIgj0r_xX8BAYTpgcqOV9vJNx16zNhe_gBBaiqvwUdHKPcrrAU-D6PxU4k3n7LCEghf6V0kvAoSA",
16
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlOTc5NDdkM2NiODU1M2MwZTQzZDg3ZiIsImlhdCI6MTU4Njk5Mjg1MiwiZXhwIjoxNTkwODgwODUyfQ.RSn_7schigJey3iLeJq0XXNGbxkrxRJYGykYvY_LIRtMk-6qBtxy7kII9-EOKYzaldV0rRpjzMhG16Ov2XePlA"
17
}
18
Copied!
HTTP Code: 400 Message: Bad Request
Description: You will see this message when the login credentials cannot be validated; either the username or password, or both are incorrect.
Sample:
1
{
2
"code": "LOCAL_AUTH_FAILED",
3
"message": "Username or Password is Invalid."
4
}
5
Copied!

Changelog

*Last updated - July 2020
Last modified 5mo ago
Copy link
Contents
Changelog