Skip to main content

V3 JS SDK Overview

The LoginRadius V3 JavaScript SDK delivers a lightweight runtime, modern hooks, and streamlined customization for any web page, whether you embed it directly on your own site or deploy it through Hosted Pages. It provides full control over authentication flows, UI behavior, and validation without vendor lock-in.

This document covers how you can utilize our various features and functionalities via using JavaScript. We have explained the implantation of LoginRadius via JS in detail below, you can customize the provided code as per your need while implementing it on your web property.

Quickstart

Initialize and render V3 components via CDN on your website.

1) Include SDK (CDN)

<link rel="stylesheet" href="https://auth-dev.lrinternal.com/LoginRadiusV3.css" />
<script src="https://auth-dev.lrinternal.com/LoginRadiusV3.js"></script>

Place scripts before code that uses LoginRadiusSDK.

2) Create SDK instance

<script>
if (window.LoginRadiusSDK) {
const options = {
apiKey: 'YOUR_API_KEY',
callbackUrl: window.location.href.split('?')[0]
};
window.LRObject = new LoginRadiusSDK(options);
}
</script>

List of available options

OptionTypeRequiredDescriptionExample
apiKeystringYesLoginRadius API key.'ABC123XYZ'
sottstringYes (registration)Secure One‑Time Token for registration flows.'SOTT_TOKEN'
verificationUrlstringNoRedirect URL for email verification and magic links.'https://example.com/verify'
resetPasswordUrlstringNoRedirect URL for password reset flows.'https://example.com/reset'
callbackUrlstringNoPost‑auth callback URL (OAuth/SSO).'https://example.com/callback'
styleNamestringNoApply predefined UI style configured in Dashboard.'MyBrand'
OtpLengthnumberNoOTP length for passwordless flows (4–8).6
OtpTypestringNoOTP type.'NUMERIC' or 'ALPHANUMERIC'
developmentModebooleanNoEnable development mode for debugging.false
passwordlessLoginEmailTemplatestringNoCustom email template for passwordless login.'passwordless-template'
callbackInsideSameWindowbooleanNoKeep auth flow in same window/tab.true
callbackTypestringNoCallback response type.'token'
scopestringNoOAuth scopes to request.'profile email'
loginUrlstringNoCustom login endpoint.'https://example.com/login'
deleteUrlstringNoCustom account-deletion endpoint.'https://example.com/delete'
emailTemplatestringNoDefault email template name.'default'
resetpinurlstringNoRedirect URL for PIN reset.'https://example.com/resetpin'
verificationEmailTemplatestringNoEmail template for verification.'verify-template'
resetPasswordEmailTemplatestringNoEmail template for password reset.'resetpwd-template'
resetPassKeyEmailTemplatestringNoEmail template for reset passkey.'resetkey-template'
resetPINEmailTemplatestringNoEmail template for PIN reset.'resetpin-template'
resetPasswordConfirmationEmailTemplatestringNoConfirmation email template after password reset.'reset-confirm-template'
resetPINConfirmationEmailTemplatestringNoConfirmation email template after PIN reset.'resetpin-confirm-template'
smartLoginRedirectUrlstringNoRedirect after smart login.'https://example.com/smart'
autoLoginRedirectUrlstringNoRedirect after auto-login.'https://example.com/autologin'
smartLoginEmailTemplatestringNoEmail template for smart login.'smart-template'
autoLoginEmailTemplatestringNoEmail template for auto-login.'autologin-template'
smsTemplate2FAstringNoSMS template for 2FA.'2fa-sms'
smsTemplateForgotstringNoSMS template for forgot password.'forgot-sms'
smsTemplateWelcomestringNoSMS template for welcome message.'welcome-sms'
smsTemplateOneTouchLoginWelcomestringNoSMS template for one-touch welcome.'onetouch-welcome-sms'
smsTemplateOneTouchLoginstringNoSMS template for one-touch login.'onetouch-sms'
passwordlessLoginSMSTemplatestringNoSMS template for passwordless login.'pwdless-sms'
smsTemplate2FAWelcomestringNoSMS template for 2FA welcome.'2fa-welcome-sms'
smsTemplatePhoneVerificationstringNoSMS template for phone verification.'phone-verify-sms'
smsTemplateUpdatePhonestringNoSMS template for phone update.'update-phone-sms'
welcomeEmailTemplatestringNoWelcome email template.'welcome-template'
onetouchLoginEmailTemplatestringNoOne-touch login email template.'onetouch-email'
deleteUserEmailTemplatestringNoAccount deletion email template.'delete-template'
onetouchLoginRedirectUrlstringNoRedirect after one-touch login.'https://example.com/onetouch'
resetPassKeyUrlstringNoRedirect URL for reset passkey.'https://example.com/resetkey'
resetPINUrlstringNoRedirect URL for PIN reset.'https://example.com/resetpin'
templateNamestringNoLegacy template name override.'legacy'
debugModebooleanNoEnable debug logging.false
tokenTypestringNoToken type returned.'lrtoken'
integrationNamestringNoIntegration identifier.'my-integration'
smartLoginPingCountnumberNoMax pings for smart login.100
smartLoginPingIntervalnumberNoPing interval (seconds) for smart login.5
crossDeviceSSOPingCountnumberNoMax pings for cross-device SSO.100
crossDeviceSSOPingIntervalnumberNoPing interval (seconds) for cross-device SSO.5
maskSensitiveInputbooleanNoMask sensitive input fields.false
enableHeaderSottbooleanNoInclude SOTT in request headers.true
accessTokenResponsebooleanNoReturn access token in response.true
rbaOneclickEmailTemplatestringNoRisk-based auth one-click email template.'rba-oneclick'
rbaOTPSmsTemplatestringNoRisk-based auth OTP SMS template.'rba-otp-sms'
rbaCityEmailTemplatestringNoRisk-based auth city change email template.'rba-city-email'
rbaCountryEmailTemplatestringNoRisk-based auth country change email template.'rba-country-email'
rbaBrowserEmailTemplatestringNoRisk-based auth browser change email template.'rba-browser-email'
rbaIpEmailTemplatestringNoRisk-based auth IP change email template.'rba-ip-email'
rbaDeviceEmailTemplatestringNoRisk-based auth device change email template.'rba-device-email'
rbaCitySmsTemplatestringNoRisk-based auth city change SMS template.'rba-city-sms'
rbaCountrySmsTemplatestringNoRisk-based auth country change SMS template.'rba-country-sms'
rbaBrowserSmsTemplatestringNoRisk-based auth browser change SMS template.'rba-browser-sms'
rbaIpSmsTemplatestringNoRisk-based auth IP change SMS template.'rba-ip-sms'
rbaDeviceSmsTemplatestringNoRisk-based auth device change SMS template.'rba-device-sms'
setLRSessionbooleanNoSet LoginRadius session cookie.false
askOptionalFieldsOnProgressiveStepsbooleanNoPrompt optional fields progressively.true
disableResendOTPButtonbooleanNoDisable resend OTP button.false
disableResendOTPButtonDelaynumberNoDelay (seconds) before enabling resend OTP.5
EmailTemplate2FAstringNoEmail template for 2FA.'2fa-email'
authenticatorOptionsOrderarrayNoOrdered list of 2FA authenticators.['emailotp','securityquestion','auth','sms','pushnotification','duomfa','passkey']
v2RecaptchaSiteKeystringNoGoogle reCAPTCHA v2 site key.'recaptcha-v2-key'
v3RecaptchaSiteKeystringNoGoogle reCAPTCHA v3 site key.'recaptcha-v3-key'
organizationObjobjectNoOrganization object for B2B features.{ id: 'org_123' }
isB2BEnabledbooleanNoEnable B2B/organization features.false
securityQuestionEnabledbooleanNoEnable security question features.false
appNamestringNoApplication name.'MyApp'
brandNamestringNoBrand name override.'MyBrand'
styleConfigobjectNoOverride style configuration.{ ... }
projectionFieldsarrayNoFields to include in profile responses.['Email','FullName']
localizationbooleanNoEnable built‑in localization.false
RegistrationFormSchemaarrayNoRegistration form fields schema.[{ name: 'Email' }]
loginLockedTypestringNoLogin lockout mode.'None'
SecurityQuestionsarrayNoAllowed security questions.['Question1','Question2']
securityQuestionsCountnumberNoRequired number of security questions.2
otpEmailVerificationbooleanNoUse email OTP for verification.false
passwordLengthobjectNoPassword length limits.{ min: 8, max: 64 }
SocialSchemaobjectNoSocial profile mapping schema.{ ... }
noCallbackForSocialLoginbooleanNoDisable callback after social login.false
noCallbackbooleanNoDisable callback redirects.false
encryptedAnswerbooleanNoEncrypt security question answers.true
optionalTwoFactorAuthenticationbooleanNoOffer optional 2FA.false
twoFactorAuthenticationbooleanNoRequire 2FA.false
qrCodeAuthenticationbooleanNoEnable QR code authentication.false
googleAuthenticationbooleanNoEnable Google Authenticator.false
emailOTPAuthenticationbooleanNoEnable Email OTP authentication.false
pushNotificationAuthenticatorbooleanNoEnable push notification authenticator.false
securityQuestionAuthenticationbooleanNoEnable security question authenticator.false
smsOTPAuthenticationbooleanNoEnable SMS OTP authenticator.false
duoAuthenticationbooleanNoEnable Duo MFA authenticator.false
passkeyAuthenticatorbooleanNoEnable Passkey authenticator.false
phoneLoginbooleanNoAllow login with phone.false
duplicateEmailWithUniqueUsernamebooleanNoAllow duplicate email with unique username.false
passwordlessLoginOTPbooleanNoEnable passwordless OTP login.false
instantOTPLoginbooleanNoEnable instant OTP login.false
optionalEmailVerificationbooleanNoMake email verification optional.false
disabledEmailVerificationbooleanNoDisable email verification.false
loginOnEmailVerificationbooleanNoAuto‑login after email verification.false
passwordlessLoginbooleanNoEnable passwordless login flows.false
instantLinkLoginbooleanNoEnable instant link login.false
askRequiredFieldForTraditionalLoginbooleanNoPrompt required fields during login.false
stayLoginbooleanNoEnable "stay logged in" option.false
disableSignupbooleanNoDisable user registration.false
riskBasedAuthenticationbooleanNoEnable risk‑based authentication.false
usernameLoginbooleanNoAllow username‑based login.false
promptPasswordOnSocialLoginbooleanNoRequire password after social login.false
askOptionalFieldsOnRegistrationbooleanNoPrompt optional fields on registration.false
askEmailForUnverifiedProfileAlwaysbooleanNoAlways prompt email for unverified profiles.false
logoutOnVerifyEmailbooleanNoLog out after email verification.false
disableAccountLinkingbooleanNoDisable account linking.false
customDomainstringNoHosted Pages custom domain.'login.example.com'
apiCustomDomainstringNoAPI custom domain.'api.example.com'
privacyPolicyConfigurationobjectNoPrivacy policy configuration.{ ... }
isConsentManagementEnabledbooleanNoEnable consent management.false
loginOnPasswordResetbooleanNoAuto‑login after password reset.false
optionalRecaptchaConfigurationobjectNoOptional captcha configuration.{ ... }
isVoiceOtpbooleanNoEnable voice OTP.false
v2RecaptchabooleanNoUse reCAPTCHA v2.false
invisibleRecaptchabooleanNoUse invisible reCAPTCHA.false
isCaptchaEnabledbooleanNoEnable captcha protection.false
tencentCaptchaAppidstringNoTencent Captcha App ID.'123456'
tencentCaptchabooleanNoEnable Tencent Captcha.false
hCaptchaSiteKeystringNohCaptcha site key.'hcaptcha-key'
captchaThemestringNoCaptcha theme (light/dark).'light'
isPassKeysEnabledbooleanNoEnable Passkeys support.false
isPasskeyAutofillbooleanNoEnable Passkey autofill.false
isPasskeyButtonbooleanNoShow Passkey login button.false
isPINAuthenticationbooleanNoEnable PIN authentication.false
PINConfigurationobjectNoPIN configuration settings.{ ... }
templateVerificationTypesobjectNoTemplate verification types.{ ... }
passkeyAuthenticationbooleanNoEnable Passkey authentication.false
pushNotificationAuthenticationbooleanNoEnable push notification authentication.false
displayPasswordStrengthbooleanNoShow password strength meter.false
contactusUrlstringNoContact‑us page URL.'https://example.com/contact'
pinSchemaarrayNoPIN form schema.[{ name: 'PIN' }]
isMobilebooleanNoHint for mobile view/behavior.false
customizeSocialPopupstringNoCustomize social login popup.'{...}'
isCustomScopebooleanNoUse custom OAuth scopes.false
clientIdstringNoWorkflow client ID.'wf-client-id'
brandstringNoWorkflow brand name.'default'
federationTokenCallbackstringNoFederation token callback URL.'https://example.com/fedcb'
isAutoLookupEnabledbooleanNoEnable auto lookup.false
isMultiCustomDomainBrandingEnabledbooleanNoEnable multi custom domain branding.false

3) Render a component

<div id="auth-container"></div>
<script>
const auth = { container: 'auth-container', onSuccess: console.log, onError: console.error };
LRObject.init('auth', auth);
</script>

4) Hooks (non-localization)

Register hooks before calling init.

LRObject.$hooks.call('formValidationRules', {
emailid: 'required|valid_email',
password: 'required|min_length[8]'
});

LRObject.$hooks.call('startProcess', function (name) {
console.log('Start', name);
});

LRObject.$hooks.call('endProcess', function (name) {
console.log('End', name);
});

When to Use

  • You’re customizing Hosted Pages V3’s behavior or validation
  • You need code-driven control beyond the Design Tab
  • You’re migrating from V2 and want streamlined hooks

Notes

  • Localization is managed in Hosted Pages UI; skip custom locale hooks here
  • Register hooks before calling LRObject.init to ensure they apply