How to deal with activation success or failure?
The sign-in in the visitor’s authenticated space fails
The iAdvize "activate" method can also fail
const iAdvizeActivationCallback = (activation) => {
console.log(activation);
}
/* In case of success, logs :
{
authentication: {
option: { type: 'SECURED_AUTHENTICATION', token: '<YOUR-TOKEN>' },
status: 'authentication-success'
}
}
/* In case of failure, logs :
{
authentication: {
option: { type: 'SECURED_AUTHENTICATION', token: '<YOUR-TOKEN>' },
status: 'authentication-failure',
reason: 'A login is already ongoing' // Or another relevant error
}
}
iAdvizeInterface.push(async (iAdvize) => {
const activation = await iAdvize.activate(async () => {
const token = await ... // your backend logic to generate a JWE - note that this can be called at anytime for refresh
return {
authenticationOption: { type: 'SECURED_AUTHENTICATION', token }
};
}) ;
iAdvizeActivationCallback(activation);
});Last updated