Authentication token for secure components
Acquire a tokenized password
Before advancing to user authentication, it's crucial to obtain a tokenizedTokenize Replace a card's primary account number (PAN) with a unique digital token that stands in for the real card during a transaction. When a cardholder adds a card to Apple Pay or Google Pay via push provisioning, the wallet provider stores a device-specific token rather than the underlying PAN, so the real card number isn't exposed on the device or shared with merchants. password. Achieve this by mounting a password component and providing your plaintext value. The value will then be returned in a tokenizedTokenize Replace a card's primary account number (PAN) with a unique digital token that stands in for the real card during a transaction. When a cardholder adds a card to Apple Pay or Google Pay via push provisioning, the wallet provider stores a device-specific token rather than the underlying PAN, so the real card number isn't exposed on the device or shared with merchants. format. For additional details on tokenizingTokenize Replace a card's primary account number (PAN) with a unique digital token that stands in for the real card during a transaction. When a cardholder adds a card to Apple Pay or Google Pay via push provisioning, the wallet provider stores a device-specific token rather than the underlying PAN, so the real card number isn't exposed on the device or shared with merchants. values with the Password Component, refer to this resource.
Now that you have the tokenizedTokenize Replace a card's primary account number (PAN) with a unique digital token that stands in for the real card during a transaction. When a cardholder adds a card to Apple Pay or Google Pay via push provisioning, the wallet provider stores a device-specific token rather than the underlying PAN, so the real card number isn't exposed on the device or shared with merchants. password, you can authenticate the user using the tokenizedTokenize Replace a card's primary account number (PAN) with a unique digital token that stands in for the real card during a transaction. When a cardholder adds a card to Apple Pay or Google Pay via push provisioning, the wallet provider stores a device-specific token rather than the underlying PAN, so the real card number isn't exposed on the device or shared with merchants. password.
You must perform this step from within your application.
- Request
- Response
{
"email": "[email protected]",
"password": {
"value": "pa$$word"
}
}
{
"token": "string",
"tokenType": "NO_TYPE",
"identity": {
"type": "CONSUMER",
"id": "string"
},
"credentials": {
"type": "ROOT",
"id": "string"
}
}
After a successful login, you receive the user authentication token as token in the response. You must then use
this token to authenticate the user in all subsequent API calls.
Setting the user token
The obtained token should subsequently be supplied to the setUserToken function, which is utilized for authenticating future requests.
weavrComponents.setUserToken('Bearer ' + {{ user_token }})
.then(() => {
// User token is set and secure components can be created and mounted
})
.catch((err) => {
// Error while setting user token. Check 'err' for more info
})
Be aware that the component's state resets during reloads. Therefore, it is advisable to perform the aforementioned steps upon each reload to guarantee continuous access to the latest authentication token for the components. Additionally, update the authentication token if it undergoes any changes during the session.
Resetting the user token
To manually reset the user token stored within the components, invoke the resetUserToken function. This action clears the existing token, enabling a fresh token to be set without requiring a full page reload.
weavrComponents.resetUserToken();