loading
Preparing LoginRadius developer resources
Mission: Help enterprises accelerate digital transformation with our fully-managed Customer IAM technology.
Skip to main content

Migration: V2 to V3 JS SDK

V3 introduces a modernized, promise-based SDK architecture that simplifies setup, improves security, and gives you more control over the authentication experience. This guide covers the key changes and provides a compatibility matrix for planning your migration.

What Changed

AreaV2V3
ArchitectureSingle global object with callback-only patternsInstance-based with promise + callback support
Initializationnew LoginRadiusV2(options) + separate LRObject.init() per actionnew LoginRadiusSDK(options) with .init(action, options) per component
ThemingManual CSSDefault brand theme from Admin Console via templateName / styleName
LocalizationHook-based (customizeFormLabel, customizeFormPlaceholder)Built-in via localizationConfig + automatic browser language detection
Hook system20+ global hooksScoped hooks per instance (async-ready)
CaptchaPer-provider config (v2RecaptchaSiteKey, invisibleRecaptcha)Unified captchaLanguage across all providers

Initialization

V2

<script src="https://auth.lrcontent.com/v2/js/LoginRadiusV2.js"></script>
<script>
var commonOptions = { apiKey: 'YOUR_API_KEY', appName: 'YOUR_APP_NAME' };
var LRObject = new LoginRadiusV2(commonOptions);

LRObject.$hooks.register('startProcess', function (name) { });
LRObject.$hooks.register('endProcess', function (name) { });

LRObject.util.ready(function () {
LRObject.init('login', {
container: 'login-container',
onSuccess: function (response) { },
onError: function (errors) { },
});
});
</script>

V3

<script src="https://auth.lrcontent.com/v2/LoginRadiusV3.js"></script>
<script>
var LRObject = new LoginRadiusSDK({
apiKey: 'YOUR_API_KEY',
sott: 'YOUR_SOTT',
callbackUrl: window.location.href.split('?')[0],
});

LRObject.init('login', {
container: 'login-container',
onSuccess: function (response) { },
onError: function (error) { },
});
</script>

Key differences:

  • appName is no longer required — the SDK resolves it automatically from the domain
  • sott is now passed in the constructor (not generated separately)
  • No util.ready() wrapper needed — the SDK handles initialization timing
  • Hooks are registered with LRObject.$hooks.call() instead of LRObject.$hooks.register()

Common Options Changes

New Options in V3

OptionDescription
templateNameApplies a configured brand from the Admin Console with its default styles
styleNameSelects a style variation within a brand template
disableLocalizationDisables automatic browser-based language detection
localizationConfigCustom label/message overrides as an object
captchaLanguageUnified CAPTCHA localization across all providers (e.g., 'de' for German)
successMessageConfigConfigure success message UI: { messageType: 'toast' | 'container' | 'none', duration: 3200 }
errorMessageConfigConfigure error message UI: { messageType: 'toast' | 'container' | 'none', duration: 3200 }

Renamed Options

V2V3Notes
v2RecaptchaLanguagecaptchaLanguageNow applies to all CAPTCHA providers, not just reCAPTCHA v2

Removed Options

These options are either handled internally by V3 or planned for future releases:

OptionV3 Status
appNameRemoved — resolved automatically from the domain URL
hashTemplatePlanned for a future release
debugModePlanned for a future release
formValidationMessagePlanned — use localizationConfig.mapValidationMessages instead
passwordLengthPlanned for a future release
twoFactorAuthenticationPlanned — MFA is configured via Admin Console
stayLoginPlanned for a future release
displayPasswordStrengthPlanned for a future release
tokenExpirePlanned for a future release
tokenTypePlanned for a future release

Compatible Options (No Changes)

These options work identically in V2 and V3:

apiKey, sott, callbackUrl, verificationUrl, callbackType, customDomain, apiCustomDomain, v2Recaptcha, isMobile, projectionFields, resetPasswordUrl, and all smsTemplate* / email template options.

Init Actions

New Actions in V3

ActionDescription
authUnified login + registration in a single component with tab switching
workflowIdentity Orchestration workflow execution — pass clientId and workflowName
orgInviteB2B invitation acceptance flow

Renamed Actions

V2V3Notes
verifyEmailverifyTokenRenamed for consistency — functionality is identical

Compatible Actions

ActionNotes
loginV3 includes a default theme, built-in Forgot Password link, and social login
registrationV3 includes a default theme, passkey registration support, and SSO
forgotPasswordV3 includes a default theme
passwordlessLoginV3 includes a default theme
profileEditorV3 includes Add Email, Add PIN, Change Password, Unlink Social. New logoutRedirectUrl option

Actions Not Yet in V3

These actions are being reintroduced in upcoming V3 releases. Where noted, functionality may be available through other actions:

V2 ActionV3 Workaround
changePasswordAvailable inside profileEditor
addEmail / removeEmailAvailable inside profileEditor
createTwoFactorAuthenticationMFA is available via login and passwordlessLogin
changePinAvailable inside profileEditor
socialLoginSocial login is built into login and auth
resetPasswordPlanned for a future release
deleteUser / deleteUserConfirmPlanned for a future release
updatePhonePlanned for a future release
onetouchLoginPlanned for a future release
smartLoginPlanned for a future release
linkAccount / unLinkAccountPlanned for a future release

Hooks

V2 Hook Registration

LRObject.$hooks.register('startProcess', function (name) { });
LRObject.$hooks.register('customizeFormLabel', { emailid: 'Work Email' });
LRObject.$hooks.register('formValidationRules', { emailid: 'required|valid_email' });

V3 Hook Registration

LRObject.$hooks.call('mapErrorMessages', [
{ code: 936, message: 'Custom error for code 936' },
]);

LRObject.$hooks.call('mapValidationMessages', [
{ rule: 'required', message: 'This field is required' },
]);

Currently Supported Hooks in V3

HookDescription
mapErrorMessagesOverride error messages by API error code
mapValidationMessagesOverride form validation messages by rule name

Hooks Not Yet in V3

Label, placeholder, and form customization hooks (customizeFormLabel, customizeFormPlaceholder, setButtonsName, formValidationRules, etc.) are planned for reintroduction. In the meantime, use localizationConfig in common options for label overrides.

Lifecycle hooks (startProcess, endProcess, afterFormRender, successCallback) are planned for reintroduction with async support.

Advanced Features

Compatible in V3

FeatureNotes
Risk Based Authentication (RBA)Works the same — configure RBA templates via common options
Profile EditorEnhanced with Add Email, Add PIN, Change Password, Unlink Social
Email Template CustomizationsSame template options in common options
Projection of FieldsSame projectionFields option

Not Yet in V3

FeatureNotes
Progressive ProfilingPlanned for a future release
Account Linking (standalone)Available via profileEditor; standalone action planned
Security QuestionsPlanned for a future release
Smart LoginPlanned for a future release
Get JWT TokenPlanned for a future release

Step-by-Step Migration

  1. Update the script tag — replace LoginRadiusV2.js with LoginRadiusV3.js (or install @loginradius/loginradius-js via npm)
  2. Update initialization — change new LoginRadiusV2(options) to new LoginRadiusSDK(options), remove appName, add sott
  3. Remove util.ready() wrappers — call init() directly
  4. Update hook registration — change $hooks.register() to $hooks.call(), migrate to mapErrorMessages / mapValidationMessages
  5. Rename actions — change verifyEmail to verifyToken
  6. Replace removed options — move label customizations to localizationConfig, remove appName
  7. Test — verify login, registration, MFA, profile, and any custom workflows
  8. Consider new features — use auth for unified login/registration, workflow for Identity Orchestration, templateName for Admin Console branding