User auth functions
confirmEmail
The confirmEmail
function uses the supplied customerEmail
and customerConfirmationKey
parameters to complete the customer activation process. Adobe Commerce sends the confirmation key to the customer when they request to create an account. The function calls the confirmEmail
mutation.
Returns
Returns a promise that resolves to a confirmEmailProps
object.
Usage
createCustomer
The createCustomer
function creates a customer account based on the data supplied in the forms
parameter. By default, the function uses the createCustomer
mutation. If the apiVersion2
parameter is set to true
, the function uses the createCustomerV2
mutation.
Customer
contains the following properties:
Returns
Returns a promise that resolves to a CreateCustomerDataResponse
object.
Usage
createCustomerAddress
The createCustomerAddress
function defines a new customer address. The customer can subseqently designate the address for billing or shipping orders. The function calls the createCustomerAddress
mutation.
AddressFormProps
contains the following properties:
Returns
Returns a promise that resolves to a CreateCustomerAddressResponse
object.
Usage
getAttributesForm
The getAttributesForm
function uses the attributesForm
query to retrieve EAV attributes associated with customer and customer address frontend forms. The function calls the attributesForm
query.
Returns
Returns a promise that resolves to an AttributesFormModel
object.
Usage
getCustomerData
The getCustomerData
function retrieves data about the customer represented by the value of the auth_dropin_user_token
parameter. The function calls the customer
query.
Returns
Returns a promise that resolves to a CustomerDataModel
object.
Usage
getCustomerToken
The getCustomerToken
function handles the sign-in operation. It requires userName
and password
parameters and performs the following actions under the hood:
Retrieves the customer token.
Fetches customer data using the token.
Sets the
auth_dropin_firstname
andauth_dropin_user_token
cookies.Publishes an Adobe Client Data Layer (ACDL) event.
Emits an “authenticated” event.
You can use the getCustomerToken
function to build a custom authentication flow that remains fully integrated with other drop-in components.
The function calls the generateCustomerToken
mutation.
Returns
getCustomerTokenProps
Usage
getStoreConfig
The getStoreConfig
function uses the storeConfig
query to retrieve store configuration data.
Returns
Returns a promise that resolves to a StoreConfigModel
object.
Usage
requestPasswordResetEmail
The requestPasswordResetEmail
function initiates the process of resetting a customer’s password. The function calls the requestPasswordResetEmail
mutation.
Returns
Returns a promise that resolves to a PasswordResetEmailModel
object.
Usage
resendConfirmationEmail
The resendConfirmationEmail
function resends the email confirmation to the customer using the supplied customerEmail
parameter. The function calls the resendConfirmationEmail
mutation, which is included in the Storefront Compatability Package.
Returns
Returns a promise that resolves to a resendConfirmationEmailResponse
object.
Usage
resetPassword
The resetPassword
function resets a customer’s password using the supplied email
, resetPasswordToken
, and newPassword
parameters. The function calls the resetPassword
mutation.
Returns
Returns a promise that resolves to a ResetPasswordModel
object.
Usage
revokeCustomerToken
The revokeCustomerToken
function revokes the customer’s token and clears cookie. It then publishes an ACDL event and emits an “authenticated” event.
This API can also be used to build a custom sign-out flow that stays fully integrated with other drop-in components.
The function calls the revokeCustomerToken
mutation.
Returns
Returns a promise that resolves to a RevokeCustomerTokenModel
object.