Advanced Customization for Login Form
Configuration Reference
var config = {
// Required Basic Configuration
ApiKeyID: "<your-API-KEY-ID>",
Type: "PHONE",
ContainerID: "cotter-container-login",
RedirectURL: "https://yourwebsite.com/account/create",
IdentifierField: "phone",
OnSuccess: payload => {
window.localStorage.setItem("session", payload.session);
window.location.href = "/dashboard";
}
OnBegin: async payload => {
var userID = await this.getUserIDFromPhone(payload.identifier);
return {
userID: userID,
err: null
};
},
// ---------
// Change Country Code
CountryCode: ["+62"], // IT HAS TO BE AN ARRAY
// Styling
ButtonBackgroundColor: "#000000",
ButtonTextColor: "#ffffff",
ButtonText: "Sign Up Now",
ErrorColor: "#ff0000",
// Event Name in the Event Response
EventName: "LOGIN_EMPLOYEE",
// Allow OTP as a fallback method for TrustedDevice
AllowOTPFallback: true,
// Skipping RedirectURL and receive event response in OnSuccess
SkipRedirectURL: true,
// Change the prompt message
AuthRequestText: {
title: "Approve this login from your phone",
subtitle: "A notification is sent to your trusted device to confirm it's you",
image: "https://yourwebsite.com/image.png",
titleError: "Something went wrong",
subtitleError: "We are unable to confirm it's you, please try again",
imageError: "https://yourwebsite.com/image.png",
imageSuccess: "https://yourwebsite.com/image.png",
switchOTPText: "Authenticate with OTP instead"
},
// Receive error message
OnError: payload => {
console.log("ERROR", payload);
}
};Description
RedirectURL
Validating Cotter's Event ResponseSkip RedirectURL
OnBegin
OnSuccess
CountryCode
AllowOTPFallback
PreviousSteps for Pop Up Authentication PromptNextAdvanced Customization for Pop Up Authentication Prompt
Last updated