Use the example SDK code in this topic to sign in or sign up a user and authenticate.
// Instantiate the input object for authenticateUser to specify parameters
const input = digitalCommerce.createAuthenticateUserInput();
input.email = "YOUR EMAIL ID";
input.password = "YOUR PASSWORD";
input.phoneNumber = "1234567889";
input.firstName = "YOUR FIRST NAME";
input.lastName = "YOUR LAST NAME";
input.signUp = true; // optional - default is false
// Invoke authenticateUser API
digitalCommerce
.authenticateUser(input)
.then(response => {
Logger.info(
"Vlocity digital commerce authenticateUser: " + JSON.stringify(response)
);
})
.catch(error => {
Logger.info("authenticateUser apexrest call failed" + error);
});
Possible error conditions:
"AuthenticateUserInput::getRequestPayload() must have email."
"AuthenticateUserInput::getRequestPayload() must have password."
"AuthenticateUserInput::getRequestPayload() must have phoneNumber."
"AssetToBasketInput::getRequestPayload() must have rootAssetIds."
"AuthenticateUserInput::getRequestPayload() must have firstName."
"AuthenticateUserInput::getRequestPayload() must have lastName.