---
schema_version: "1"
id: c08c7b3936a0b40123289fe32b0ffb87d9f523643a42a62b75de5fc60af372ec
title: "SDK Example: Authenticate a User (Winter '20)"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sdk-exampleauthenticate-a-userwinter20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampleauthenticate-a-userwinter20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e0eb427ca3fafa0bf1edf8e611a78a9e90be1021be7c78059627b32e116e43de
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Authenticate a User (Winter '20)

Use the example SDK code in this topic to sign in or sign up a user and authenticate.

```nolang
// 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.
