Skip to content

The LoginRadius Node JS library will let you integrate LoginRadius' customer identity platform with your Node JS application(s).

License

Notifications You must be signed in to change notification settings

dbrenot-pelmorex/node-js-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node-js-sdk-v2

Customer Identity public repo for Node.js V2 SDK, based on LoginRadius V2 APIs.

Home Image

Introduction

LoginRadius Node.js Customer Registration wrapper provides access to LoginRadius Identity Management Platform API.

LoginRadius is an Identity Management Platform that simplifies user registration while securing data. LoginRadius Platform simplifies and secures your user registration process, increases conversion with Social Login that combines 30 major social platforms, and offers a full solution with Traditional User Registration. You can gather a wealth of user profile data from Social Login or Traditional User Registration.

LoginRadius centralizes it all in one place, making it easy to manage and access. Easily integrate LoginRadius with all of your third-party applications, like MailChimp, Google Analytics, Livefyre and many more, making it easy to utilize the data you are capturing.

LoginRadius helps businesses boost user engagement on their web/mobile platform, manage online identities, utilize social media for marketing, capture accurate consumer data, and get unique social insight into their customer base.

Please visit here for more information.

Installing

$ npm install loginradius-sdk

Documentation


Disclaimer
This library is meant to help you with a quick implementation of the LoginRadius platform and also to serve as a reference point for the LoginRadius API. Keep in mind that it is an open source library, which means you are free to download and customize the library functions based on your specific application needs.

LoginRadius Combined Node SDK features a combined SDK set to encompass Social Login, User Registration, and Custom Object.

Getting Started

This document contains information and examples regarding the LoginRadius Node.js SDK. It provides guidance for working with social authentication, user profile data, and sending messages with a variety of social networks such as Facebook, Google, Twitter, Yahoo, LinkedIn, and more. You can get the SDK from here

Note: The latest version(11.1.0) of Node js SDK works with LoginRadius V2 APIs.

Installation
run npm install loginradius-sdk
Configuration
Create var config in project

  var config = {
      apiDomain: 'api.loginradius.com',
      apiKey: '{{ Your API KEY }}',
      apiSecret: '{{ Your API Secret }}',
      siteName: '{{ Your Sitename }}',
	  apiRequestSigning: false,
      proxy:{
        host:'',
        port:'',
        user:'',
        password:''
     }
  }

Replace the placeholders in the config object with your LoginRadius credentials apikey, apisecret, sitename. These can be obtained from here

Pass the proxy configurations if you want to set Http Server Proxy Configuration through your NodeJs SDK. Host and port are required to set Http Server Proxy configuration (username and password are optional).

X-Origin-IP

LoginRadius allows you to add X-Origin-IP in your headers and it determines the IP address of the client's request,this can also be useful to overcome analytics discrepancies where the analytics depend on header data.

 originIp:"{{ Client Ip }}"

The originIp will be added in var config

Implementation

Require the loginradius-sdk package and pass the config object.

  var lrv2 = require('loginradius-sdk')(config);

The below APIs will be used to implement the loginradius functionalities.

Authentication API

List of APIs in this Section:

Auth Update Profile by Token (PUT)

This API is used to update the user's profile by passing the access token. More Info

var accessToken = "<accessToken>"; //Required

var userProfileUpdateModel ={ 
"firstName" : "<firstName>",
"lastName" : "<lastName>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var nullSupport = true; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.authenticationApi.updateProfileByAccessToken(accessToken, userProfileUpdateModel, emailTemplate, fields, nullSupport, smsTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Unlock Account by Access Token (PUT)

This API is used to allow a customer with a valid access token to unlock their account provided that they successfully pass the prompted Bot Protection challenges. The Block or Suspend block types are not applicable for this API. For additional details see our Auth Security Configuration documentation.You are only required to pass the Post Parameters that correspond to the prompted challenges. More Info

var accessToken = "<accessToken>"; //Required

var unlockProfileModel ={ 
"g-recaptcha-response" : "<g-recaptcha-response>"
};  //Required

lrv2.authenticationApi.unlockAccountByToken(accessToken, unlockProfileModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Verify Email By OTP (PUT)

This API is used to verify the email of user when the OTP Email verification flow is enabled, please note that you must contact LoginRadius to have this feature enabled. More Info

var emailVerificationByOtpModel ={ 
"email" : "<email>",
"otp" : "<otp>"
};  //Required
var fields = null; //Optional
var url = "<url>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.verifyEmailByOTP(emailVerificationByOtpModel, fields, url, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Reset Password by Security Answer and Email (PUT)

This API is used to reset password for the specified account by security question More Info

var resetPasswordBySecurityAnswerAndEmailModel ={ 
"email" : "<email>",
"password" : "<password>",
"securityAnswer" : {"QuestionID":"Answer"}
};  //Required

lrv2.authenticationApi.resetPasswordBySecurityAnswerAndEmail(resetPasswordBySecurityAnswerAndEmailModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Reset Password by Security Answer and Phone (PUT)

This API is used to reset password for the specified account by security question More Info

var resetPasswordBySecurityAnswerAndPhoneModel ={ 
"password" : "<password>",
"phone" : "<phone>",
"securityAnswer" : {"QuestionID":"Answer"}
};  //Required

lrv2.authenticationApi.resetPasswordBySecurityAnswerAndPhone(resetPasswordBySecurityAnswerAndPhoneModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Reset Password by Security Answer and UserName (PUT)

This API is used to reset password for the specified account by security question More Info

var resetPasswordBySecurityAnswerAndUserNameModel ={ 
"password" : "<password>",
"securityAnswer" : {"QuestionID":"Answer"},
"userName" : "<userName>"
};  //Required

lrv2.authenticationApi.resetPasswordBySecurityAnswerAndUserName(resetPasswordBySecurityAnswerAndUserNameModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Reset Password by Reset Token (PUT)

This API is used to set a new password for the specified account. More Info

var resetPasswordByResetTokenModel ={ 
"password" : "<password>",
"resetToken" : "<resetToken>"
};  //Required

lrv2.authenticationApi.resetPasswordByResetToken(resetPasswordByResetTokenModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Reset Password by OTP (PUT)

This API is used to set a new password for the specified account. More Info

var resetPasswordByEmailAndOtpModel ={ 
"email" : "<email>",
"otp" : "<otp>",
"password" : "<password>"
};  //Required

lrv2.authenticationApi.resetPasswordByEmailOTP(resetPasswordByEmailAndOtpModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Reset Password by OTP and UserName (PUT)

This API is used to set a new password for the specified account if you are using the username as the unique identifier in your workflow More Info

var resetPasswordByUserNameModel ={ 
"otp" : "<otp>",
"password" : "<password>",
"userName" : "<userName>"
};  //Required

lrv2.authenticationApi.resetPasswordByOTPAndUserName(resetPasswordByUserNameModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Change Password (PUT)

This API is used to change the accounts password based on the previous password More Info

var accessToken = "<accessToken>"; //Required
var newPassword = "<newPassword>"; //Required
var oldPassword = "<oldPassword>"; //Required

lrv2.authenticationApi.changePassword(accessToken, newPassword, oldPassword).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Set or Change UserName (PUT)

This API is used to set or change UserName by access token. More Info

var accessToken = "<accessToken>"; //Required
var username = "<username>"; //Required

lrv2.authenticationApi.setOrChangeUserName(accessToken, username).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Resend Email Verification (PUT)

This API resends the verification email to the user. More Info

var email = "<email>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.authenticationApi.authResendEmailVerification(email, emailTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Add Email (POST)

This API is used to add additional emails to a user's account. More Info

var accessToken = "<accessToken>"; //Required
var email = "<email>"; //Required
var type = "<type>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.authenticationApi.addEmail(accessToken, email, type, emailTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Login by Email (POST)

This API retrieves a copy of the user data based on the Email More Info

var emailAuthenticationModel ={ 
"email" : "<email>",
"password" : "<password>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.authenticationApi.loginByEmail(emailAuthenticationModel, emailTemplate, fields, loginUrl, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Login by Username (POST)

This API retrieves a copy of the user data based on the Username More Info

var userNameAuthenticationModel ={ 
"password" : "<password>",
"username" : "<username>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.authenticationApi.loginByUserName(userNameAuthenticationModel, emailTemplate, fields, loginUrl, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Forgot Password (POST)

This API is used to send the reset password url to a specified account. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' More Info

var email = "<email>"; //Required
var resetPasswordUrl = "<resetPasswordUrl>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional

lrv2.authenticationApi.forgotPassword(email, resetPasswordUrl, emailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Link Social Identities (POST)

This API is used to link up a social provider account with an existing LoginRadius account on the basis of access token and the social providers user access token. More Info

var accessToken = "<accessToken>"; //Required
var candidateToken = "<candidateToken>"; //Required

lrv2.authenticationApi.linkSocialIdentities(accessToken, candidateToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Link Social Identities By Ping (POST)

This API is used to link up a social provider account with an existing LoginRadius account on the basis of ping and the social providers user access token. More Info

var accessToken = "<accessToken>"; //Required
var clientGuid = "<clientGuid>"; //Required

lrv2.authenticationApi.linkSocialIdentitiesByPing(accessToken, clientGuid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth User Registration by Email (POST)

This API creates a user in the database as well as sends a verification email to the user. More Info

var authUserRegistrationModel ={ 
"email" : [   { 
"type" : "<type>"  ,
"value" : "<value>"   
}  ] ,
"firstName" : "<firstName>",
"lastName" : "<lastName>",
"password" : "<password>"
};  //Required
var sott = "<sott>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var options = "<options>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.userRegistrationByEmail(authUserRegistrationModel, sott, emailTemplate, fields, options, verificationUrl, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth User Registration By Captcha (POST)

This API creates a user in the database as well as sends a verification email to the user. More Info

var authUserRegistrationModelWithCaptcha ={ 
"email" : [   { 
"type" : "<type>"  ,
"value" : "<value>"   
}  ] ,
"firstName" : "<firstName>",
"g-recaptcha-response" : "<g-recaptcha-response>",
"lastName" : "<lastName>",
"password" : "<password>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var options = "<options>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.userRegistrationByCaptcha(authUserRegistrationModelWithCaptcha, emailTemplate, fields, options, smsTemplate, verificationUrl, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Security Questions By Email (GET)

This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. More Info

var email = "<email>"; //Required

lrv2.authenticationApi.getSecurityQuestionsByEmail(email).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Security Questions By UserName (GET)

This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. More Info

var userName = "<userName>"; //Required

lrv2.authenticationApi.getSecurityQuestionsByUserName(userName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Security Questions By Phone (GET)

This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. More Info

var phone = "<phone>"; //Required

lrv2.authenticationApi.getSecurityQuestionsByPhone(phone).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Security Questions By Access Token (GET)

This API is used to retrieve the list of questions that are configured on the respective LoginRadius site. More Info

var accessToken = "<accessToken>"; //Required

lrv2.authenticationApi.getSecurityQuestionsByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Validate Access token (GET)

This api validates access token, if valid then returns a response with its expiry otherwise error. More Info

var accessToken = "<accessToken>"; //Required

lrv2.authenticationApi.authValidateAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token Invalidate (GET)

This api call invalidates the active access token or expires an access token's validity. More Info

var accessToken = "<accessToken>"; //Required
var preventRefresh = true; //Optional

lrv2.authenticationApi.authInValidateAccessToken(accessToken, preventRefresh).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token Info (GET)

This api call provide the active access token Information More Info

var accessToken = "<accessToken>"; //Required

lrv2.authenticationApi.getAccessTokenInfo(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Read all Profiles by Token (GET)

This API retrieves a copy of the user data based on the access token. More Info

var accessToken = "<accessToken>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.getProfileByAccessToken(accessToken, emailTemplate, fields, verificationUrl, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Send Welcome Email (GET)

This API sends a welcome email More Info

var accessToken = "<accessToken>"; //Required
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.sendWelcomeEmail(accessToken, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Delete Account (GET)

This API is used to delete an account by passing it a delete token. More Info

var deletetoken = "<deletetoken>"; //Required

lrv2.authenticationApi.deleteAccountByDeleteToken(deletetoken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Profile By Ping (GET)

This API is used to get a user's profile using the clientGuid parameter if no callback feature enabled. More Info

var clientGuid = "<clientGuid>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.getProfileByPing(clientGuid, emailTemplate, fields, verificationUrl, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Check Email Availability (GET)

This API is used to check the email exists or not on your site. More Info

var email = "<email>"; //Required

lrv2.authenticationApi.checkEmailAvailability(email).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Verify Email (GET)

This API is used to verify the email of user. Note: This API will only return the full profile if you have 'Enable auto login after email verification' set in your LoginRadius Admin Console's Email Workflow settings under 'Verification Email'. More Info

var verificationToken = "<verificationToken>"; //Required
var fields = null; //Optional
var url = "<url>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.authenticationApi.verifyEmail(verificationToken, fields, url, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Check UserName Availability (GET)

This API is used to check the UserName exists or not on your site. More Info

var username = "<username>"; //Required

lrv2.authenticationApi.checkUserNameAvailability(username).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Privacy Policy Accept (GET)

This API is used to update the privacy policy stored in the user's profile by providing the access token of the user accepting the privacy policy More Info

var accessToken = "<accessToken>"; //Required
var fields = null; //Optional

lrv2.authenticationApi.acceptPrivacyPolicy(accessToken, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Privacy Policy History By Access Token (GET)

This API will return all the accepted privacy policies for the user by providing the access token of that user. More Info

var accessToken = "<accessToken>"; //Required

lrv2.authenticationApi.getPrivacyPolicyHistoryByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Delete Account with Email Confirmation (DELETE)

This API will send a confirmation email for account deletion to the customer's email when passed the customer's access token More Info

var accessToken = "<accessToken>"; //Required
var deleteUrl = "<deleteUrl>"; //Optional
var emailTemplate = "<emailTemplate>"; //Optional

lrv2.authenticationApi.deleteAccountWithEmailConfirmation(accessToken, deleteUrl, emailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Remove Email (DELETE)

This API is used to remove additional emails from a user's account. More Info

var accessToken = "<accessToken>"; //Required
var email = "<email>"; //Required

lrv2.authenticationApi.removeEmail(accessToken, email).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Auth Unlink Social Identities (DELETE)

This API is used to unlink up a social provider account with the specified account based on the access token and the social providers user access token. The unlinked account will automatically get removed from your database. More Info

var accessToken = "<accessToken>"; //Required
var provider = "<provider>"; //Required
var providerId = "<providerId>"; //Required

lrv2.authenticationApi.unlinkSocialIdentities(accessToken, provider, providerId).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

Account API

List of APIs in this Section:

Account Update (PUT)

This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section Here for more capabilities. More Info

var accountUserProfileUpdateModel ={ 
"firstName" : "<firstName>",
"lastName" : "<lastName>"
};  //Required
var uid = "<uid>"; //Required
var fields = null; //Optional
var nullSupport = true; //Optional

lrv2.accountApi.updateAccountByUid(accountUserProfileUpdateModel, uid, fields, nullSupport).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Update Phone ID by UID (PUT)

This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process. More Info

var phone = "<phone>"; //Required
var uid = "<uid>"; //Required
var fields = null; //Optional

lrv2.accountApi.updatePhoneIDByUid(phone, uid, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Set Password (PUT)

This API is used to set the password of an account in Cloud Storage. More Info

var password = "<password>"; //Required
var uid = "<uid>"; //Required

lrv2.accountApi.setAccountPasswordByUid(password, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Invalidate Verification Email (PUT)

This API is used to invalidate the Email Verification status on an account. More Info

var uid = "<uid>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.accountApi.invalidateAccountEmailVerification(uid, emailTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset phone ID verification (PUT)

This API Allows you to reset the phone no verification of an end user’s account. More Info

var uid = "<uid>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.accountApi.resetPhoneIDVerificationByUid(uid, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Upsert Email (PUT)

This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array. More Info

var upsertEmailModel ={ 
"email" : [   { 
"type" : "<type>"  ,
"value" : "<value>"   
}  ] 
};  //Required
var uid = "<uid>"; //Required
var fields = null; //Optional

lrv2.accountApi.upsertEmail(upsertEmailModel, uid, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Update UID (PUT)

This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid. More Info

var updateUidModel ={ 
"newUid" : "<newUid>"
};  //Required
var uid = "<uid>"; //Required

lrv2.accountApi.accountUpdateUid(updateUidModel, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Create (POST)

This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user.

In order to use this API, you need to format a JSON request body with all of the mandatory fields More Info

var accountCreateModel ={ 
"email" : [   { 
"type" : "<type>"  ,
"value" : "<value>"   
}  ] ,
"firstName" : "<firstName>",
"lastName" : "<lastName>",
"password" : "<password>"
};  //Required
var fields = null; //Optional

lrv2.accountApi.createAccount(accountCreateModel, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Forgot Password token (POST)

This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body. More Info

var email = "<email>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var resetPasswordUrl = "<resetPasswordUrl>"; //Optional
var sendEmail = true; //Optional

lrv2.accountApi.getForgotPasswordToken(email, emailTemplate, resetPasswordUrl, sendEmail).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Email Verification token (POST)

This API Returns an Email Verification token. More Info

var email = "<email>"; //Required

lrv2.accountApi.getEmailVerificationToken(email).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Privacy Policy History By Uid (GET)

This API is used to retrieve all of the accepted Policies by the user, associated with their UID. More Info

var uid = "<uid>"; //Required

lrv2.accountApi.getPrivacyPolicyHistoryByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Profiles by Email (GET)

This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage. More Info

var email = "<email>"; //Required
var fields = null; //Optional

lrv2.accountApi.getAccountProfileByEmail(email, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Profiles by Username (GET)

This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage. More Info

var userName = "<userName>"; //Required
var fields = null; //Optional

lrv2.accountApi.getAccountProfileByUserName(userName, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Profile by Phone ID (GET)

This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage. More Info

var phone = "<phone>"; //Required
var fields = null; //Optional

lrv2.accountApi.getAccountProfileByPhone(phone, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Profiles by UID (GET)

This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage. More Info

var uid = "<uid>"; //Required
var fields = null; //Optional

lrv2.accountApi.getAccountProfileByUid(uid, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Password (GET)

This API use to retrive the hashed password of a specified account in Cloud Storage. More Info

var uid = "<uid>"; //Required

lrv2.accountApi.getAccountPasswordHashByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token based on UID or User impersonation API (GET)

The API is used to get LoginRadius access token based on UID. More Info

var uid = "<uid>"; //Required

lrv2.accountApi.getAccessTokenByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Refresh Access Token by Refresh Token (GET)

This API is used to refresh an access token via it's associated refresh token. More Info

var refreshToken = "<refreshToken>"; //Required

lrv2.accountApi.refreshAccessTokenByRefreshToken(refreshToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Revoke Refresh Token (GET)

The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry. More Info

var refreshToken = "<refreshToken>"; //Required

lrv2.accountApi.revokeRefreshToken(refreshToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Identities by Email (GET)

Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage. More Info

var email = "<email>"; //Required
var fields = null; //Optional

lrv2.accountApi.getAccountIdentitiesByEmail(email, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Delete (DELETE)

This API deletes the Users account and allows them to re-register for a new account. More Info

var uid = "<uid>"; //Required

lrv2.accountApi.deleteAccountByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Remove Email (DELETE)

Use this API to Remove emails from a user Account More Info

var email = "<email>"; //Required
var uid = "<uid>"; //Required
var fields = null; //Optional

lrv2.accountApi.removeEmail(email, uid, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Delete User Profiles By Email (DELETE)

This API is used to delete all user profiles associated with an Email. More Info

var email = "<email>"; //Required

lrv2.accountApi.accountDeleteByEmail(email).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

Social API

List of APIs in this Section:

Access Token (GET)

This API Is used to translate the Request Token returned during authentication into an Access Token that can be used with other API calls. More Info

var token = "<token>"; //Required

lrv2.socialApi.exchangeAccessToken(token).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Refresh Token (GET)

The Refresh Access Token API is used to refresh the provider access token after authentication. It will be valid for up to 60 days on LoginRadius depending on the provider. In order to use the access token in other APIs, always refresh the token using this API.

Supported Providers : Facebook,Yahoo,Google,Twitter, Linkedin.

Contact LoginRadius support team to enable this API. More Info

var accessToken = "<accessToken>"; //Required
var expiresIn = 0; //Optional
var isWeb = true; //Optional

lrv2.socialApi.refreshAccessToken(accessToken, expiresIn, isWeb).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Token Validate (GET)

This API validates access token, if valid then returns a response with its expiry otherwise error. More Info

var accessToken = "<accessToken>"; //Required

lrv2.socialApi.validateAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token Invalidate (GET)

This api invalidates the active access token or expires an access token validity. More Info

var accessToken = "<accessToken>"; //Required

lrv2.socialApi.inValidateAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Active Session Details (GET)

This api is use to get all active session by Access Token. More Info

var token = "<token>"; //Required

lrv2.socialApi.getActiveSession(token).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Active Session By Account Id (GET)

This api is used to get all active sessions by AccountID(UID). More Info

var accountId = "<accountId>"; //Required

lrv2.socialApi.getActiveSessionByAccountID(accountId).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Active Session By Profile Id (GET)

This api is used to get all active sessions by ProfileId. More Info

var profileId = "<profileId>"; //Required

lrv2.socialApi.getActiveSessionByProfileID(profileId).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

CustomObject API

List of APIs in this Section:

Custom Object Update by Access Token (PUT)

This API is used to update the specified custom object data of the specified account. If the value of updatetype is 'replace' then it will fully replace custom object with the new custom object and if the value of updatetype is 'partialreplace' then it will perform an upsert type operation More Info

var accessToken = "<accessToken>"; //Required
var objectName = "<objectName>"; //Required
var objectRecordId = "<objectRecordId>"; //Required

var object = { "customdata1": "Store my customdata1 value" };  //Required
var updateType = "<updateType>"; //Optional

lrv2.customObjectApi.updateCustomObjectByToken(accessToken, objectName, objectRecordId, object, updateType).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Custom Object Update by UID (PUT)

This API is used to update the specified custom object data of a specified account. If the value of updatetype is 'replace' then it will fully replace custom object with new custom object and if the value of updatetype is partialreplace then it will perform an upsert type operation. More Info

var objectName = "<objectName>"; //Required
var objectRecordId = "<objectRecordId>"; //Required

var object = { "customdata1": "Store my customdata1 value" };  //Required
var uid = "<uid>"; //Required
var updateType = "<updateType>"; //Optional

lrv2.customObjectApi.updateCustomObjectByUid(objectName, objectRecordId, object, uid, updateType).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Create Custom Object by Token (POST)

This API is used to write information in JSON format to the custom object for the specified account. More Info

var accessToken = "<accessToken>"; //Required
var objectName = "<objectName>"; //Required

var object = { "customdata1": "Store my customdata1 value" };  //Required

lrv2.customObjectApi.createCustomObjectByToken(accessToken, objectName, object).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Create Custom Object by UID (POST)

This API is used to write information in JSON format to the custom object for the specified account. More Info

var objectName = "<objectName>"; //Required

var object = { "customdata1": "Store my customdata1 value" };  //Required
var uid = "<uid>"; //Required

lrv2.customObjectApi.createCustomObjectByUid(objectName, object, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Custom Object by Token (GET)

This API is used to retrieve the specified Custom Object data for the specified account. More Info

var accessToken = "<accessToken>"; //Required
var objectName = "<objectName>"; //Required

lrv2.customObjectApi.getCustomObjectByToken(accessToken, objectName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Custom Object by ObjectRecordId and Token (GET)

This API is used to retrieve the Custom Object data for the specified account. More Info

var accessToken = "<accessToken>"; //Required
var objectName = "<objectName>"; //Required
var objectRecordId = "<objectRecordId>"; //Required

lrv2.customObjectApi.getCustomObjectByRecordIDAndToken(accessToken, objectName, objectRecordId).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Custom Object By UID (GET)

This API is used to retrieve all the custom objects by UID from cloud storage. More Info

var objectName = "<objectName>"; //Required
var uid = "<uid>"; //Required

lrv2.customObjectApi.getCustomObjectByUid(objectName, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Custom Object by ObjectRecordId and UID (GET)

This API is used to retrieve the Custom Object data for the specified account. More Info

var objectName = "<objectName>"; //Required
var objectRecordId = "<objectRecordId>"; //Required
var uid = "<uid>"; //Required

lrv2.customObjectApi.getCustomObjectByRecordID(objectName, objectRecordId, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Custom Object Delete by Record Id And Token (DELETE)

This API is used to remove the specified Custom Object data using ObjectRecordId of a specified account. More Info

var accessToken = "<accessToken>"; //Required
var objectName = "<objectName>"; //Required
var objectRecordId = "<objectRecordId>"; //Required

lrv2.customObjectApi.deleteCustomObjectByToken(accessToken, objectName, objectRecordId).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Delete Custom Object by ObjectRecordId (DELETE)

This API is used to remove the specified Custom Object data using ObjectRecordId of specified account. More Info

var objectName = "<objectName>"; //Required
var objectRecordId = "<objectRecordId>"; //Required
var uid = "<uid>"; //Required

lrv2.customObjectApi.deleteCustomObjectByRecordID(objectName, objectRecordId, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

PhoneAuthentication API

List of APIs in this Section:

Phone Reset Password by OTP (PUT)

This API is used to reset the password More Info

var resetPasswordByOTPModel ={ 
"otp" : "<otp>",
"password" : "<password>",
"phone" : "<phone>"
};  //Required

lrv2.phoneAuthenticationApi.resetPasswordByPhoneOTP(resetPasswordByOTPModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Verification OTP (PUT)

This API is used to validate the verification code sent to verify a user's phone number More Info

var otp = "<otp>"; //Required
var phone = "<phone>"; //Required
var fields = null; //Optional
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.phoneVerificationByOTP(otp, phone, fields, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Verification OTP by Token (PUT)

This API is used to consume the verification code sent to verify a user's phone number. Use this call for front-end purposes in cases where the user is already logged in by passing the user's access token. More Info

var accessToken = "<accessToken>"; //Required
var otp = "<otp>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.phoneVerificationOTPByAccessToken(accessToken, otp, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Number Update (PUT)

This API is used to update the login Phone Number of users More Info

var accessToken = "<accessToken>"; //Required
var phone = "<phone>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.updatePhoneNumber(accessToken, phone, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Login (POST)

This API retrieves a copy of the user data based on the Phone More Info

var phoneAuthenticationModel ={ 
"password" : "<password>",
"phone" : "<phone>"
};  //Required
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.loginByPhone(phoneAuthenticationModel, fields, loginUrl, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Forgot Password by OTP (POST)

This API is used to send the OTP to reset the account password. More Info

var phone = "<phone>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.forgotPasswordByPhoneOTP(phone, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Resend Verification OTP (POST)

This API is used to resend a verification OTP to verify a user's Phone Number. The user will receive a verification code that they will need to input More Info

var phone = "<phone>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.phoneResendVerificationOTP(phone, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Resend Verification OTP By Token (POST)

This API is used to resend a verification OTP to verify a user's Phone Number in cases in which an active token already exists More Info

var accessToken = "<accessToken>"; //Required
var phone = "<phone>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.phoneAuthenticationApi.phoneResendVerificationOTPByToken(accessToken, phone, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone User Registration by SMS (POST)

This API registers the new users into your Cloud Storage and triggers the phone verification process. More Info

var authUserRegistrationModel ={ 
"email" : [   { 
   "type" : "<type>"  ,
   "value" : "<value>"   
}  ] ,
"firstName" : "<firstName>",
"lastName" : "<lastName>",
"password" : "<password>",
"phoneId" : "<phoneId>"
};  //Required
var sott = "<sott>"; //Required
var fields = null; //Optional
var options = "<options>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional
var emailTemplate = "<emailTemplate>"; //Optional

lrv2.phoneAuthenticationApi.userRegistrationByPhone(authUserRegistrationModel, sott, fields, options, smsTemplate, verificationUrl, welcomeEmailTemplate, emailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Phone Number Availability (GET)

This API is used to check the Phone Number exists or not on your site. More Info

var phone = "<phone>"; //Required

lrv2.phoneAuthenticationApi.checkPhoneNumberAvailability(phone).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Remove Phone ID by Access Token (DELETE)

This API is used to delete the Phone ID on a user's account via the access token More Info

var accessToken = "<accessToken>"; //Required

lrv2.phoneAuthenticationApi.removePhoneIDByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

MultiFactorAuthentication API

List of APIs in this Section:

Update MFA Setting (PUT)

This API is used to trigger the Multi-factor authentication settings after login for secure actions More Info

var accessToken = "<accessToken>"; //Required

var multiFactorAuthModelWithLockout ={ 
"otp" : "<otp>"
};  //Required
var fields = null; //Optional

lrv2.multiFactorAuthenticationApi.mfaUpdateSetting(accessToken, multiFactorAuthModelWithLockout, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Update MFA by Access Token (PUT)

This API is used to Enable Multi-factor authentication by access token on user login More Info

var accessToken = "<accessToken>"; //Required

var multiFactorAuthModelByGoogleAuthenticatorCode ={ 
"googleAuthenticatorCode" : "<googleAuthenticatorCode>"
};  //Required
var fields = null; //Optional
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaUpdateByAccessToken(accessToken, multiFactorAuthModelByGoogleAuthenticatorCode, fields, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Update Phone Number by Token (PUT)

This API is used to update the Multi-factor authentication phone number by sending the verification OTP to the provided phone number More Info

var accessToken = "<accessToken>"; //Required
var phoneNo2FA = "<phoneNo2FA>"; //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaUpdatePhoneNumberByToken(accessToken, phoneNo2FA, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Verify MFA Email OTP by Access Token (PUT)

This API is used to set up MFA Email OTP authenticator on profile after login. More Info

var accessToken = "<accessToken>"; //Required

var multiFactorAuthModelByEmailOtpWithLockout ={ 
"EmailId":"emailId",
"Otp":"otp"
 };  //Required

lrv2.multiFactorAuthenticationApi.mfaValidateEmailOtpByAccessToken(accessToken, multiFactorAuthModelByEmailOtpWithLockout).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Update MFA Security Question by Access Token (PUT)

This API is used to set up MFA Security Question authenticator on profile after login. More Info

var accessToken = "<accessToken>"; //Required

var securityQuestionAnswerModelByAccessToken ={  
    "securityquestionanswer": [
       {
           "QuestionId": "db7****8a73e4******bd9****8c20",
           "Answer": "<answer>"
       }
   ],
    "ReplaceSecurityQuestionAnswer":false // required
};  //Required

lrv2.multiFactorAuthenticationApi.mfaSecurityQuestionAnswerByAccessToken(accessToken, securityQuestionAnswerModelByAccessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Validate OTP (PUT)

This API is used to login via Multi-factor authentication by passing the One Time Password received via SMS More Info

var multiFactorAuthModelWithLockout ={ 
"otp" : "<otp>"
};  //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var fields = null; //Optional
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaValidateOTPByPhone(multiFactorAuthModelWithLockout, secondFactorAuthenticationToken, fields,smsTemplate2FA, rbaBrowserEmailTemplate, rbaCityEmailTemplate, rbaCountryEmailTemplate, rbaIpEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Validate Google Auth Code (PUT)

This API is used to login via Multi-factor-authentication by passing the google authenticator code. More Info

var googleAuthenticatorCode = "<googleAuthenticatorCode>"; //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var fields = null; //Optional
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaValidateGoogleAuthCode(googleAuthenticatorCode, secondFactorAuthenticationToken, fields, rbaBrowserEmailTemplate, rbaCityEmailTemplate, rbaCountryEmailTemplate, rbaIpEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Validate Backup code (PUT)

This API is used to validate the backup code provided by the user and if valid, we return an access token allowing the user to login incases where Multi-factor authentication (MFA) is enabled and the secondary factor is unavailable. When a user initially downloads the Backup codes, We generate 10 codes, each code can only be consumed once. if any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically More Info

var multiFactorAuthModelByBackupCode ={ 
"backupCode" : "<backupCode>"
};  //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var fields = null; //Optional
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaValidateBackupCode(multiFactorAuthModelByBackupCode, secondFactorAuthenticationToken, fields, rbaBrowserEmailTemplate, rbaCityEmailTemplate, rbaCountryEmailTemplate, rbaIpEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Update Phone Number (PUT)

This API is used to update (if configured) the phone number used for Multi-factor authentication by sending the verification OTP to the provided phone number More Info

var phoneNo2FA = "<phoneNo2FA>"; //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaUpdatePhoneNumber(phoneNo2FA, secondFactorAuthenticationToken, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Verify MFA Email OTP by MFA Token (PUT)

This API is used to Verify MFA Email OTP by MFA Token More Info

var multiFactorAuthModelByEmailOtp ={ 
   "EmailId":"email",
   "Otp":"otp"
 };  //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaValidateEmailOtp(multiFactorAuthModelByEmailOtp, secondFactorAuthenticationToken, rbaBrowserEmailTemplate, rbaCityEmailTemplate, rbaCountryEmailTemplate, rbaIpEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Update MFA Security Question by MFA Token (PUT)

This API is used to set the security questions on the profile with the MFA token when MFA flow is required. More Info

var securityQuestionAnswerUpdateModel ={  
   "securityquestionanswer": [
       {
           "QuestionId": "db7****8a73e4******bd9****8c20",
           "Answer": "<answer>"
       }
   ]
};  //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required

lrv2.multiFactorAuthenticationApi.mfaSecurityQuestionAnswer(securityQuestionAnswerUpdateModel, secondFactorAuthenticationToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Email Login (POST)

This API can be used to login by emailid on a Multi-factor authentication enabled LoginRadius site. More Info

var email = "<email>"; //Required
var password = "<password>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var emailTemplate2FA = "<emailTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaLoginByEmail(email, password, emailTemplate, fields, loginUrl, smsTemplate, smsTemplate2FA, verificationUrl,emailTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA UserName Login (POST)

This API can be used to login by username on a Multi-factor authentication enabled LoginRadius site. More Info

var password = "<password>"; //Required
var username = "<username>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var emailTemplate2FA = "<emailTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaLoginByUserName(password, username, emailTemplate, fields, loginUrl, smsTemplate, smsTemplate2FA, verificationUrl, emailTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Phone Login (POST)

This API can be used to login by Phone on a Multi-factor authentication enabled LoginRadius site. More Info

var password = "<password>"; //Required
var phone = "<phone>"; //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional
var emailTemplate2FA = "<emailTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaLoginByPhone(password, phone, emailTemplate, fields, loginUrl, smsTemplate, smsTemplate2FA, verificationUrl, emailTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Send MFA Email OTP by MFA Token (POST)

An API designed to send the MFA Email OTP to the email. More Info

var emailIdModel ={  
"EmailId":"email"
};  //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var emailTemplate2FA = "<emailTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaEmailOTP(emailIdModel, secondFactorAuthenticationToken, emailTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Verify MFA Security Question by MFA Token (POST)

This API is used to resending the verification OTP to the provided phone number More Info

var securityQuestionAnswerUpdateModel ={ 
     "securityquestionanswer": [
       {
           "QuestionId": "db7****8a73e4******bd9****8c20",
           "Answer": "<answer>"
       }
   ]
 };  //Required
var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaSecurityQuestionAnswerVerification(securityQuestionAnswerUpdateModel, secondFactorAuthenticationToken, rbaBrowserEmailTemplate, rbaCityEmailTemplate, rbaCountryEmailTemplate, rbaIpEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Validate Access Token (GET)

This API is used to configure the Multi-factor authentication after login by using the access token when MFA is set as optional on the LoginRadius site. More Info

var accessToken = "<accessToken>"; //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaConfigureByAccessToken(accessToken, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Backup Code by Access Token (GET)

This API is used to get a set of backup codes via access token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically More Info

var accessToken = "<accessToken>"; //Required

lrv2.multiFactorAuthenticationApi.mfaBackupCodeByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset Backup Code by Access Token (GET)

API is used to reset the backup codes on a given account via the access token. This API call will generate 10 new codes, each code can only be consumed once More Info

var accessToken = "<accessToken>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetBackupCodeByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Send MFA Email OTP by Access Token (GET)

This API is created to send the OTP to the email if email OTP authenticator is enabled in app's MFA configuration. More Info

var accessToken = "<accessToken>"; //Required
var emailId = "<emailId>"; //Required
var emailTemplate2FA = "<emailTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaEmailOtpByAccessToken(accessToken, emailId, emailTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Resend Otp (GET)

This API is used to resending the verification OTP to the provided phone number More Info

var secondFactorAuthenticationToken = "<secondFactorAuthenticationToken>"; //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.multiFactorAuthenticationApi.mfaResendOTP(secondFactorAuthenticationToken, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Backup Code by UID (GET)

This API is used to reset the backup codes on a given account via the UID. This API call will generate 10 new codes, each code can only be consumed once. More Info

var uid = "<uid>"; //Required

lrv2.multiFactorAuthenticationApi.mfaBackupCodeByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Reset Backup Code by UID (GET)

This API is used to reset the backup codes on a given account via the UID. This API call will generate 10 new codes, each code can only be consumed once. More Info

var uid = "<uid>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetBackupCodeByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Reset Google Authenticator by Token (DELETE)

This API Resets the Google Authenticator configurations on a given account via the access token More Info

var accessToken = "<accessToken>"; //Required
var googleauthenticator = true; //Required

lrv2.multiFactorAuthenticationApi.mfaResetGoogleAuthByToken(accessToken, googleauthenticator).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Reset SMS Authenticator by Token (DELETE)

This API resets the SMS Authenticator configurations on a given account via the access token. More Info

var accessToken = "<accessToken>"; //Required
var otpauthenticator = true; //Required

lrv2.multiFactorAuthenticationApi.mfaResetSMSAuthByToken(accessToken, otpauthenticator).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset MFA Email OTP Authenticator By Access Token (DELETE)

This API is used to reset the Email OTP Authenticator settings for an MFA-enabled user More Info

var accessToken = "<accessToken>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetEmailOtpAuthenticatorByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Reset Security Question Authenticator By Access Token (DELETE)

This API is used to Reset MFA Security Question Authenticator By Access Token More Info

var accessToken = "<accessToken>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetSecurityQuestionAuthenticatorByAccessToken(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Reset SMS Authenticator By UID (DELETE)

This API resets the SMS Authenticator configurations on a given account via the UID. More Info

var otpauthenticator = true; //Required
var uid = "<uid>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetSMSAuthenticatorByUid(otpauthenticator, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Reset Google Authenticator By UID (DELETE)

This API resets the Google Authenticator configurations on a given account via the UID. More Info

var googleauthenticator = true; //Required
var uid = "<uid>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetGoogleAuthenticatorByUid(googleauthenticator, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset MFA Email OTP Authenticator Settings by Uid (DELETE)

This API is used to reset the Email OTP Authenticator settings for an MFA-enabled user. More Info

var uid = "<uid>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetEmailOtpAuthenticatorByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset MFA Security Question Authenticator Settings by Uid (DELETE)

This API is used to reset the Security Question Authenticator settings for an MFA-enabled user. More Info

var uid = "<uid>"; //Required

lrv2.multiFactorAuthenticationApi.mfaResetSecurityQuestionAuthenticatorByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

PINAuthentication API

List of APIs in this Section:

Reset PIN By ResetToken (PUT)

This API is used to reset pin using reset token. More Info

var resetPINByResetToken ={ 
"pin" : "<pin>",
"resetToken" : "<resetToken>"
};  //Required

lrv2.pinAuthenticationApi.resetPINByResetToken(resetPINByResetToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset PIN By SecurityAnswer And Email (PUT)

This API is used to reset pin using security question answer and email. More Info

var resetPINBySecurityQuestionAnswerAndEmailModel ={ 
"email" : "<email>",
"pin" : "<pin>",
"securityAnswer" : {"QuestionID":"Answer"}
};  //Required

lrv2.pinAuthenticationApi.resetPINByEmailAndSecurityAnswer(resetPINBySecurityQuestionAnswerAndEmailModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset PIN By SecurityAnswer And Username (PUT)

This API is used to reset pin using security question answer and username. More Info

var resetPINBySecurityQuestionAnswerAndUsernameModel ={ 
"pin" : "<pin>",
"securityAnswer" : {"QuestionID":"Answer"},
"username" : "<username>"
};  //Required

lrv2.pinAuthenticationApi.resetPINByUsernameAndSecurityAnswer(resetPINBySecurityQuestionAnswerAndUsernameModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset PIN By SecurityAnswer And Phone (PUT)

This API is used to reset pin using security question answer and phone. More Info

var resetPINBySecurityQuestionAnswerAndPhoneModel ={ 
"phone" : "<phone>",
"pin" : "<pin>",
"securityAnswer" : {"QuestionID":"Answer"}
};  //Required

lrv2.pinAuthenticationApi.resetPINByPhoneAndSecurityAnswer(resetPINBySecurityQuestionAnswerAndPhoneModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Change PIN By Token (PUT)

This API is used to change a user's PIN using access token. More Info

var accessToken = "<accessToken>"; //Required

var changePINModel ={ 
"newPIN" : "<newPIN>",
"oldPIN" : "<oldPIN>"
};  //Required

lrv2.pinAuthenticationApi.changePINByAccessToken(accessToken, changePINModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset PIN by Phone and OTP (PUT)

This API is used to reset pin using phoneId and OTP. More Info

var resetPINByPhoneAndOTPModel ={ 
"otp" : "<otp>",
"phone" : "<phone>",
"pin" : "<pin>"
};  //Required

lrv2.pinAuthenticationApi.resetPINByPhoneAndOtp(resetPINByPhoneAndOTPModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset PIN by Email and OTP (PUT)

This API is used to reset pin using email and OTP. More Info

var resetPINByEmailAndOtpModel ={ 
"email" : "<email>",
"otp" : "<otp>",
"pin" : "<pin>"
};  //Required

lrv2.pinAuthenticationApi.resetPINByEmailAndOtp(resetPINByEmailAndOtpModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Reset PIN by Username and OTP (PUT)

This API is used to reset pin using username and OTP. More Info

var resetPINByUsernameAndOtpModel ={ 
"otp" : "<otp>",
"pin" : "<pin>",
"username" : "<username>"
};  //Required

lrv2.pinAuthenticationApi.resetPINByUsernameAndOtp(resetPINByUsernameAndOtpModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
PIN Login (POST)

This API is used to login a user by pin and session token. More Info

var loginByPINModel ={ 
"pin" : "<pin>"
};  //Required
var sessionToken = "<sessionToken>"; //Required

lrv2.pinAuthenticationApi.pinLogin(loginByPINModel, sessionToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Forgot PIN By Email (POST)

This API sends the reset pin email to specified email address. More Info

var forgotPINLinkByEmailModel ={ 
"email" : "<email>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var resetPINUrl = "<resetPINUrl>"; //Optional

lrv2.pinAuthenticationApi.sendForgotPINEmailByEmail(forgotPINLinkByEmailModel, emailTemplate, resetPINUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Forgot PIN By UserName (POST)

This API sends the reset pin email using username. More Info

var forgotPINLinkByUserNameModel ={ 
"userName" : "<userName>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var resetPINUrl = "<resetPINUrl>"; //Optional

lrv2.pinAuthenticationApi.sendForgotPINEmailByUsername(forgotPINLinkByUserNameModel, emailTemplate, resetPINUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Forgot PIN By Phone (POST)

This API sends the OTP to specified phone number More Info

var forgotPINOtpByPhoneModel ={ 
"phone" : "<phone>"
};  //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.pinAuthenticationApi.sendForgotPINSMSByPhone(forgotPINOtpByPhoneModel, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Set PIN By PinAuthToken (POST)

This API is used to change a user's PIN using Pin Auth token. More Info

var pinRequiredModel ={ 
"pin" : "<pin>"
};  //Required
var pinAuthToken = "<pinAuthToken>"; //Required

lrv2.pinAuthenticationApi.setPINByPinAuthToken(pinRequiredModel, pinAuthToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Invalidate PIN Session Token (GET)

This API is used to invalidate pin session token. More Info

var sessionToken = "<sessionToken>"; //Required

lrv2.pinAuthenticationApi.inValidatePinSessionToken(sessionToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

ReAuthentication API

List of APIs in this Section:

Validate MFA by OTP (PUT)

This API is used to re-authenticate via Multi-factor authentication by passing the One Time Password received via SMS More Info

var accessToken = "<accessToken>"; //Required

var reauthByOtpModel ={ 
"otp" : "<otp>"
};  //Required

lrv2.reAuthenticationApi.mfaReAuthenticateByOTP(accessToken, reauthByOtpModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Validate MFA by Backup Code (PUT)

This API is used to re-authenticate by set of backup codes via access token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device More Info

var accessToken = "<accessToken>"; //Required

var reauthByBackupCodeModel ={ 
"backupCode" : "<backupCode>"
};  //Required

lrv2.reAuthenticationApi.mfaReAuthenticateByBackupCode(accessToken, reauthByBackupCodeModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Validate MFA by Google Authenticator Code (PUT)

This API is used to re-authenticate via Multi-factor-authentication by passing the google authenticator code More Info

var accessToken = "<accessToken>"; //Required

var reauthByGoogleAuthenticatorCodeModel ={ 
"googleAuthenticatorCode" : "<googleAuthenticatorCode>"
};  //Required

lrv2.reAuthenticationApi.mfaReAuthenticateByGoogleAuth(accessToken, reauthByGoogleAuthenticatorCodeModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Validate MFA by Password (PUT)

This API is used to re-authenticate via Multi-factor-authentication by passing the password More Info

var accessToken = "<accessToken>"; //Required

var passwordEventBasedAuthModelWithLockout ={ 
"password" : "<password>"
};  //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.reAuthenticationApi.mfaReAuthenticateByPassword(accessToken, passwordEventBasedAuthModelWithLockout, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Re-authentication by PIN (PUT)

This API is used to validate the triggered MFA authentication flow with a password. More Info

var accessToken = "<accessToken>"; //Required

var pinAuthEventBasedAuthModelWithLockout ={ 
"pin" : "<pin>"
};  //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.reAuthenticationApi.verifyPINAuthentication(accessToken, pinAuthEventBasedAuthModelWithLockout, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Re-authentication by Email OTP (PUT)

This API is used to validate the triggered MFA authentication flow with an Email OTP. More Info

var accessToken = "<accessToken>"; //Required

var reauthByEmailOtpModel ={  
 "EmailId":"email",
 "otp": "otp"
};  //Required

lrv2.reAuthenticationApi.reAuthValidateEmailOtp(accessToken, reauthByEmailOtpModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Verify Multifactor OTP Authentication (POST)

This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by OTP. More Info

var eventBasedMultiFactorToken ={ 
"secondFactorValidationToken" : "<secondFactorValidationToken>"
};  //Required
var uid = "<uid>"; //Required

lrv2.reAuthenticationApi.verifyMultiFactorOtpReauthentication(eventBasedMultiFactorToken, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Verify Multifactor Password Authentication (POST)

This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by password. More Info

var eventBasedMultiFactorToken ={ 
"secondFactorValidationToken" : "<secondFactorValidationToken>"
};  //Required
var uid = "<uid>"; //Required

lrv2.reAuthenticationApi.verifyMultiFactorPasswordReauthentication(eventBasedMultiFactorToken, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Verify Multifactor PIN Authentication (POST)

This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by PIN. More Info

var eventBasedMultiFactorToken ={ 
"secondFactorValidationToken" : "<secondFactorValidationToken>"
};  //Required
var uid = "<uid>"; //Required

lrv2.reAuthenticationApi.verifyMultiFactorPINReauthentication(eventBasedMultiFactorToken, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
MFA Re-authentication by Security Question (POST)

This API is used to validate the triggered MFA re-authentication flow with security questions answers. More Info

var accessToken = "<accessToken>"; //Required

var securityQuestionAnswerUpdateModel ={  
   "securityquestionanswer": [
       {
           "QuestionId": "db7****8a73e4******bd9****8c20",
           "Answer": "<answer>"
       }
   ]
};  //Required

lrv2.reAuthenticationApi.reAuthBySecurityQuestion(accessToken, securityQuestionAnswerUpdateModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Multi Factor Re-Authenticate (GET)

This API is used to trigger the Multi-Factor Autentication workflow for the provided access token More Info

var accessToken = "<accessToken>"; //Required
var smsTemplate2FA = "<smsTemplate2FA>"; //Optional

lrv2.reAuthenticationApi.mfaReAuthenticate(accessToken, smsTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Send MFA Re-auth Email OTP by Access Token (GET)

This API is used to send the MFA Email OTP to the email for Re-authentication More Info

var accessToken = "<accessToken>"; //Required
var emailId = "<emailId>"; //Required
var emailTemplate2FA = "<emailTemplate2FA>"; //Optional

lrv2.reAuthenticationApi.reAuthSendEmailOtp(accessToken, emailId, emailTemplate2FA).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

ConsentManagement API

List of APIs in this Section:

Update Consent By Access Token (PUT)

This API is to update consents using access token. More Info

var accessToken = "<accessToken>"; //Required

var consentUpdateModel ={ 
"consents" : [   { 
"consentOptionId" : "<consentOptionId>"  ,
"isAccepted" : true  
}  ] 
};  //Required

lrv2.consentManagementApi.updateConsentProfileByAccessToken(accessToken, consentUpdateModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Consent By ConsentToken (POST)

This API is to submit consent form using consent token. More Info

var consentToken = "<consentToken>"; //Required

var consentSubmitModel ={ 
"data" : [   { 
"consentOptionId" : "<consentOptionId>"  ,
"isAccepted" : true  
}  ] ,
"events" : [   { 
"event" : "<event>"  ,
"isCustom" : true  
}  ] 
};  //Required

lrv2.consentManagementApi.submitConsentByConsentToken(consentToken, consentSubmitModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Post Consent By Access Token (POST)

API to provide a way to end user to submit a consent form for particular event type. More Info

var accessToken = "<accessToken>"; //Required

var consentSubmitModel ={ 
"data" : [   { 
"consentOptionId" : "<consentOptionId>"  ,
"isAccepted" : true  
}  ] ,
"events" : [   { 
"event" : "<event>"  ,
"isCustom" : true  
}  ] 
};  //Required

lrv2.consentManagementApi.submitConsentByAccessToken(accessToken, consentSubmitModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Consent Logs By Uid (GET)

This API is used to get the Consent logs of the user. More Info

var uid = "<uid>"; //Required

lrv2.consentManagementApi.getConsentLogsByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Consent Log by Access Token (GET)

This API is used to fetch consent logs. More Info

var accessToken = "<accessToken>"; //Required

lrv2.consentManagementApi.getConsentLogs(accessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Verify Consent By Access Token (GET)

This API is used to check if consent is submitted for a particular event or not. More Info

var accessToken = "<accessToken>"; //Required
var event = "<event>"; //Required
var isCustom = true; //Required

lrv2.consentManagementApi.verifyConsentByAccessToken(accessToken, event, isCustom).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

SmartLogin API

List of APIs in this Section:

Smart Login Verify Token (GET)

This API verifies the provided token for Smart Login More Info

var verificationToken = "<verificationToken>"; //Required
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.smartLoginApi.smartLoginTokenVerification(verificationToken, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Smart Login By Email (GET)

This API sends a Smart Login link to the user's Email Id. More Info

var clientGuid = "<clientGuid>"; //Required
var email = "<email>"; //Required
var redirectUrl = "<redirectUrl>"; //Optional
var smartLoginEmailTemplate = "<smartLoginEmailTemplate>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.smartLoginApi.smartLoginByEmail(clientGuid, email, redirectUrl, smartLoginEmailTemplate, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Smart Login By Username (GET)

This API sends a Smart Login link to the user's Email Id. More Info

var clientGuid = "<clientGuid>"; //Required
var username = "<username>"; //Required
var redirectUrl = "<redirectUrl>"; //Optional
var smartLoginEmailTemplate = "<smartLoginEmailTemplate>"; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.smartLoginApi.smartLoginByUserName(clientGuid, username, redirectUrl, smartLoginEmailTemplate, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Smart Login Ping (GET)

This API is used to check if the Smart Login link has been clicked or not More Info

var clientGuid = "<clientGuid>"; //Required
var fields = null; //Optional

lrv2.smartLoginApi.smartLoginPing(clientGuid, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

OneTouchLogin API

List of APIs in this Section:

One Touch OTP Verification (PUT)

This API is used to verify the otp for One Touch Login. More Info

var otp = "<otp>"; //Required
var phone = "<phone>"; //Required
var fields = null; //Optional
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.oneTouchLoginApi.oneTouchLoginOTPVerification(otp, phone, fields, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
One Touch Login by Email (POST)

This API is used to send a link to a specified email for a frictionless login/registration More Info

var oneTouchLoginByEmailModel ={ 
"clientguid" : "<clientguid>",
"email" : "<email>",
"g-recaptcha-response" : "<g-recaptcha-response>"
};  //Required
var oneTouchLoginEmailTemplate = "<oneTouchLoginEmailTemplate>"; //Optional
var redirecturl = "<redirecturl>"; //Optional
var welcomeemailtemplate = "<welcomeemailtemplate>"; //Optional

lrv2.oneTouchLoginApi.oneTouchLoginByEmail(oneTouchLoginByEmailModel, oneTouchLoginEmailTemplate, redirecturl, welcomeemailtemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
One Touch Login by Phone (POST)

This API is used to send one time password to a given phone number for a frictionless login/registration. More Info

var oneTouchLoginByPhoneModel ={ 
"g-recaptcha-response" : "<g-recaptcha-response>",
"phone" : "<phone>"
};  //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.oneTouchLoginApi.oneTouchLoginByPhone(oneTouchLoginByPhoneModel, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
One Touch Email Verification (GET)

This API verifies the provided token for One Touch Login More Info

var verificationToken = "<verificationToken>"; //Required
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.oneTouchLoginApi.oneTouchEmailVerification(verificationToken, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
One Touch Login Ping (GET)

This API is used to check if the One Touch Login link has been clicked or not. More Info

var clientGuid = "<clientGuid>"; //Required
var fields = null; //Optional

lrv2.oneTouchLoginApi.oneTouchLoginPing(clientGuid, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

PasswordLessLogin API

List of APIs in this Section:

Passwordless Login Phone Verification (PUT)

This API verifies an account by OTP and allows the customer to login. More Info

var passwordLessLoginOtpModel ={ 
"otp" : "<otp>",
"phone" : "<phone>"
};  //Required
var fields = null; //Optional
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginPhoneVerification(passwordLessLoginOtpModel, fields, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Passwordless Login Verification By Email And OTP (POST)

This API is used to verify the otp sent to the email when doing a passwordless login. More Info

var passwordLessLoginByEmailAndOtpModel ={
"email": "<email>",
"otp": "<otp>",
"welcomeemailtemplate": "<welcome_email_template>"
};  //Required
var fields = null; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginVerificationByEmailAndOTP(passwordLessLoginByEmailAndOtpModel, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Passwordless Login Verification By User Name And OTP (POST)

This API is used to verify the otp sent to the email when doing a passwordless login. More Info

var passwordLessLoginByUserNameAndOtpModel ={
"username": "<User name>",
"otp": "<otp>",
"welcomeemailtemplate": "<welcome_email_template>"
};  //Required
var fields = null; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginVerificationByUserNameAndOTP(passwordLessLoginByUserNameAndOtpModel, fields).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Passwordless Login by Phone (GET)

API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID More Info

var phone = "<phone>"; //Required
var smsTemplate = "<smsTemplate>"; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginByPhone(phone, smsTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Passwordless Login By Email (GET)

This API is used to send a Passwordless Login verification link to the provided Email ID More Info

var email = "<email>"; //Required
var passwordLessLoginTemplate = "<passwordLessLoginTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginByEmail(email, passwordLessLoginTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Passwordless Login By UserName (GET)

This API is used to send a Passwordless Login Verification Link to a customer by providing their UserName More Info

var username = "<username>"; //Required
var passwordLessLoginTemplate = "<passwordLessLoginTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginByUserName(username, passwordLessLoginTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Passwordless Login Verification (GET)

This API is used to verify the Passwordless Login verification link. Note: If you are using Passwordless Login by Phone you will need to use the Passwordless Login Phone Verification API More Info

var verificationToken = "<verificationToken>"; //Required
var fields = null; //Optional
var welcomeEmailTemplate = "<welcomeEmailTemplate>"; //Optional

lrv2.passwordLessLoginApi.passwordlessLoginVerification(verificationToken, fields, welcomeEmailTemplate).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

Configuration API

List of APIs in this Section:

Get Server Time (GET)

This API allows you to query your LoginRadius account for basic server information and server time information which is useful when generating an SOTT token. More Info

var timeDifference = 0; //Optional

lrv2.configurationApi.getServerInfo(timeDifference).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Configuration (GET)

This API is used to get the configurations which are set in the LoginRadius Admin Console for a particular LoginRadius site/environment. More info

lrv2.configurationApi.getConfigurations().then((response) => {
  console.log(response);
}).catch((error) => {
  console.log(error);
});

Role API

List of APIs in this Section:

Assign Roles by UID (PUT)

This API is used to assign your desired roles to a given user. More Info

var accountRolesModel ={ 
"roles" : [  "roles" ] 
};  //Required
var uid = "<uid>"; //Required

lrv2.roleApi.assignRolesByUid(accountRolesModel, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Upsert Context (PUT)

This API creates a Context with a set of Roles More Info

var accountRoleContextModel ={ 
"roleContext" : [   { 
 "additionalPermissions" : ["<additionalPermissions>" ] ,
"context" : "<context>"  ,
"expiration" : "<expiration>"  ,
 "roles" : ["<roles>" ]  
}  ] 
};  //Required
var uid = "<uid>"; //Required

lrv2.roleApi.updateRoleContextByUid(accountRoleContextModel, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Add Permissions to Role (PUT)

This API is used to add permissions to a given role. More Info

var permissionsModel ={ 
"permissions" : [  "permissions" ] 
};  //Required
var role = "<role>"; //Required

lrv2.roleApi.addRolePermissions(permissionsModel, role).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Roles Create (POST)

This API creates a role with permissions. More Info

var rolesModel ={ 
"roles" : [   { 
"name" : "<name>"  ,
"permissions" : {"Permission_name":true}  
}  ] 
};  //Required

lrv2.roleApi.createRoles(rolesModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Roles by UID (GET)

API is used to retrieve all the assigned roles of a particular User. More Info

var uid = "<uid>"; //Required

lrv2.roleApi.getRolesByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Context with Roles and Permissions (GET)

This API Gets the contexts that have been configured and the associated roles and permissions. More Info

var uid = "<uid>"; //Required

lrv2.roleApi.getRoleContextByUid(uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Role Context profile (GET)

The API is used to retrieve role context by the context name. More Info

var contextName = "<contextName>"; //Required

lrv2.roleApi.getRoleContextByContextName(contextName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Roles List (GET)

This API retrieves the complete list of created roles with permissions of your app. More Info

lrv2.roleApi.getRolesList().then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Unassign Roles by UID (DELETE)

This API is used to unassign roles from a user. More Info

var accountRolesModel ={ 
"roles" : [  "roles" ] 
};  //Required
var uid = "<uid>"; //Required

lrv2.roleApi.unassignRolesByUid(accountRolesModel, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Delete Role Context (DELETE)

This API Deletes the specified Role Context More Info

var contextName = "<contextName>"; //Required
var uid = "<uid>"; //Required

lrv2.roleApi.deleteRoleContextByUid(contextName, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Delete Role from Context (DELETE)

This API Deletes the specified Role from a Context. More Info

var contextName = "<contextName>"; //Required

var roleContextRemoveRoleModel ={ 
"roles" : [  "roles" ] 
};  //Required
var uid = "<uid>"; //Required

lrv2.roleApi.deleteRolesFromRoleContextByUid(contextName, roleContextRemoveRoleModel, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Delete Additional Permission from Context (DELETE)

This API Deletes Additional Permissions from Context. More Info

var contextName = "<contextName>"; //Required

var roleContextAdditionalPermissionRemoveRoleModel ={ 
"additionalPermissions" : [  "additionalPermissions" ] 
};  //Required
var uid = "<uid>"; //Required

lrv2.roleApi.deleteAdditionalPermissionFromRoleContextByUid(contextName, roleContextAdditionalPermissionRemoveRoleModel, uid).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Account Delete Role (DELETE)

This API is used to delete the role. More Info

var role = "<role>"; //Required

lrv2.roleApi.deleteRole(role).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Remove Permissions (DELETE)

API is used to remove permissions from a role. More Info

var permissionsModel ={ 
"permissions" : [  "permissions" ] 
};  //Required
var role = "<role>"; //Required

lrv2.roleApi.removeRolePermissions(permissionsModel, role).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

RiskBasedAuthentication API

List of APIs in this Section:

Risk Based Authentication Login by Email (POST)

This API retrieves a copy of the user data based on the Email More Info

var emailAuthenticationModel ={ 
"email" : "<email>",
"password" : "<password>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var passwordDelegation = true; //Optional
var passwordDelegationApp = "<passwordDelegationApp>"; //Optional
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaBrowserSmsTemplate = "<rbaBrowserSmsTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCitySmsTemplate = "<rbaCitySmsTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaCountrySmsTemplate = "<rbaCountrySmsTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional
var rbaIpSmsTemplate = "<rbaIpSmsTemplate>"; //Optional
var rbaOneclickEmailTemplate = "<rbaOneclickEmailTemplate>"; //Optional
var rbaOTPSmsTemplate = "<rbaOTPSmsTemplate>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.riskBasedAuthenticationApi.rbaLoginByEmail(emailAuthenticationModel, emailTemplate, fields, loginUrl, passwordDelegation, passwordDelegationApp, rbaBrowserEmailTemplate, rbaBrowserSmsTemplate, rbaCityEmailTemplate, rbaCitySmsTemplate, rbaCountryEmailTemplate, rbaCountrySmsTemplate, rbaIpEmailTemplate, rbaIpSmsTemplate, rbaOneclickEmailTemplate, rbaOTPSmsTemplate, smsTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Risk Based Authentication Login by Username (POST)

This API retrieves a copy of the user data based on the Username More Info

var userNameAuthenticationModel ={ 
"password" : "<password>",
"username" : "<username>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var passwordDelegation = true; //Optional
var passwordDelegationApp = "<passwordDelegationApp>"; //Optional
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaBrowserSmsTemplate = "<rbaBrowserSmsTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCitySmsTemplate = "<rbaCitySmsTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaCountrySmsTemplate = "<rbaCountrySmsTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional
var rbaIpSmsTemplate = "<rbaIpSmsTemplate>"; //Optional
var rbaOneclickEmailTemplate = "<rbaOneclickEmailTemplate>"; //Optional
var rbaOTPSmsTemplate = "<rbaOTPSmsTemplate>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.riskBasedAuthenticationApi.rbaLoginByUserName(userNameAuthenticationModel, emailTemplate, fields, loginUrl, passwordDelegation, passwordDelegationApp, rbaBrowserEmailTemplate, rbaBrowserSmsTemplate, rbaCityEmailTemplate, rbaCitySmsTemplate, rbaCountryEmailTemplate, rbaCountrySmsTemplate, rbaIpEmailTemplate, rbaIpSmsTemplate, rbaOneclickEmailTemplate, rbaOTPSmsTemplate, smsTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Risk Based Authentication Phone Login (POST)

This API retrieves a copy of the user data based on the Phone More Info

var phoneAuthenticationModel ={ 
"password" : "<password>",
"phone" : "<phone>"
};  //Required
var emailTemplate = "<emailTemplate>"; //Optional
var fields = null; //Optional
var loginUrl = "<loginUrl>"; //Optional
var passwordDelegation = true; //Optional
var passwordDelegationApp = "<passwordDelegationApp>"; //Optional
var rbaBrowserEmailTemplate = "<rbaBrowserEmailTemplate>"; //Optional
var rbaBrowserSmsTemplate = "<rbaBrowserSmsTemplate>"; //Optional
var rbaCityEmailTemplate = "<rbaCityEmailTemplate>"; //Optional
var rbaCitySmsTemplate = "<rbaCitySmsTemplate>"; //Optional
var rbaCountryEmailTemplate = "<rbaCountryEmailTemplate>"; //Optional
var rbaCountrySmsTemplate = "<rbaCountrySmsTemplate>"; //Optional
var rbaIpEmailTemplate = "<rbaIpEmailTemplate>"; //Optional
var rbaIpSmsTemplate = "<rbaIpSmsTemplate>"; //Optional
var rbaOneclickEmailTemplate = "<rbaOneclickEmailTemplate>"; //Optional
var rbaOTPSmsTemplate = "<rbaOTPSmsTemplate>"; //Optional
var smsTemplate = "<smsTemplate>"; //Optional
var verificationUrl = "<verificationUrl>"; //Optional

lrv2.riskBasedAuthenticationApi.rbaLoginByPhone(phoneAuthenticationModel, emailTemplate, fields, loginUrl, passwordDelegation, passwordDelegationApp, rbaBrowserEmailTemplate, rbaBrowserSmsTemplate, rbaCityEmailTemplate, rbaCitySmsTemplate, rbaCountryEmailTemplate, rbaCountrySmsTemplate, rbaIpEmailTemplate, rbaIpSmsTemplate, rbaOneclickEmailTemplate, rbaOTPSmsTemplate, smsTemplate, verificationUrl).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

Sott API

List of APIs in this Section:

Generate SOTT (GET)

This API allows you to generate SOTT with a given expiration time. More Info

var timeDifference = 0; //Optional



lrv2.sottApi.generateSott(timeDifference).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

NativeSocial API

List of APIs in this Section:

Access Token via Facebook Token (GET)

The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response. More Info

var fbAccessToken = "<fbAccessToken>"; //Required
var socialAppName = "<socialAppName>"; //Optional

lrv2.nativeSocialApi.getAccessTokenByFacebookAccessToken(fbAccessToken, socialAppName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token via Twitter Token (GET)

The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response. More Info

var twAccessToken = "<twAccessToken>"; //Required
var twTokenSecret = "<twTokenSecret>"; //Required
var socialAppName = "<socialAppName>"; //Optional

lrv2.nativeSocialApi.getAccessTokenByTwitterAccessToken(twAccessToken, twTokenSecret, socialAppName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token via Google Token (GET)

The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response. More Info

var googleAccessToken = "<googleAccessToken>"; //Required
var clientId = "<clientId>"; //Optional
var refreshToken = "<refreshToken>"; //Optional
var socialAppName = "<socialAppName>"; //Optional

lrv2.nativeSocialApi.getAccessTokenByGoogleAccessToken(googleAccessToken, clientId, refreshToken, socialAppName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token using google JWT token for Native Mobile Login (GET)

This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration. More Info

var idToken = "<idToken>"; //Required

lrv2.nativeSocialApi.getAccessTokenByGoogleJWTAccessToken(idToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token via Linkedin Token (GET)

The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response. More Info

var lnAccessToken = "<lnAccessToken>"; //Required
var socialAppName = "<socialAppName>"; //Optional

lrv2.nativeSocialApi.getAccessTokenByLinkedinAccessToken(lnAccessToken, socialAppName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Get Access Token By Foursquare Access Token (GET)

The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response. More Info

var fsAccessToken = "<fsAccessToken>"; //Required

lrv2.nativeSocialApi.getAccessTokenByFoursquareAccessToken(fsAccessToken).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token via Apple Id Code (GET)

The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response. More Info

var code = "<code>"; //Required
var socialAppName = "<socialAppName>"; //Optional

lrv2.nativeSocialApi.getAccessTokenByAppleIdCode(code, socialAppName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token via WeChat Code (GET)

This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. More Info

var code = "<code>"; //Required

lrv2.nativeSocialApi.getAccessTokenByWeChatCode(code).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Access Token via Google AuthCode (GET)

The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response. More Info

var googleAuthcode = "<googleAuthcode>"; //Required
var socialAppName = "<socialAppName>"; //Optional

lrv2.nativeSocialApi.getAccessTokenByGoogleAuthCode(googleAuthcode, socialAppName).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

WebHook API

List of APIs in this Section:

Webhook Subscribe (POST)

API can be used to configure a WebHook on your LoginRadius site. Webhooks also work on subscribe and notification model, subscribe your hook and get a notification. Equivalent to RESThook but these provide security on basis of signature and RESThook work on unique URL. Following are the events that are allowed by LoginRadius to trigger a WebHook service call. More Info

var webHookSubscribeModel ={ 
"event" : "<event>",
"targetUrl" : "<targetUrl>"
};  //Required

lrv2.webHookApi.webHookSubscribe(webHookSubscribeModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Webhook Subscribed URLs (GET)

This API is used to fatch all the subscribed URLs, for particular event More Info

var event = "<event>"; //Required

lrv2.webHookApi.getWebHookSubscribedURLs(event).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
Webhook Test (GET)

API can be used to test a subscribed WebHook. More Info

lrv2.webHookApi.webhookTest().then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});
WebHook Unsubscribe (DELETE)

API can be used to unsubscribe a WebHook configured on your LoginRadius site. More Info

var webHookSubscribeModel ={ 
"event" : "<event>",
"targetUrl" : "<targetUrl>"
};  //Required

lrv2.webHookApi.webHookUnsubscribe(webHookSubscribeModel).then((response) => {
   console.log(response);
}).catch((error) => {
   console.log(error);
});

Generate SOTT Manually

SOTT is a secure one-time token that can be created using the API key, API secret, and a timestamp ( start time and end time ). You can manually create a SOTT using the following util function.

var sottConfig={
     apiKey: '', //(Optional) LoginRadius Api Key.
     apiSecret: '', //(Optional) LoginRadius Api Secret (Only Primary Api Secret is used to generate the SOTT manually).	
};

//do not pass the time difference if you are passing startTime & endTime.

var timeDifference="5"; // (Optional) The time difference will be used to set the expiration time of SOTT, If you do not pass time difference then the default expiration time of SOTT is 10 minutes.


// You can pass the start and end time interval and the SOTT will be valid for this time duration. 

var startDate="2022-05-17 07:10:42"; // (Optional) Valid Start Date with Date and time

var endDate="2022-05-17 07:20:42"; // (Optional) Valid End Date with Date and time


lrv2.helper.getSott(sottConfig,startDate, endDate,timeDifference).then(function (sott) {
       console.log(sott)
});

Demo

We have a demo web application using the Node SDK, which includes the following features:

  • Traditional email login
  • Multi-Factor login
  • Passwordless login
  • Social login
  • Register
  • Email verification
  • Forgot password
  • Reset password
  • Change password
  • Set password
  • Update account
  • Account linking
  • Custom object management
  • Roles management

You can get a copy of our demo project at Github .

Demo Configuration

Terminal/Command Line:

  1. Install Node.Js here . Ensure npm --version and node --version runs properly

  2. Navigate to the demo directory, and run: npm install

  3. Set your LoginRadius credentials on the client and server side:

    • Client side: demo/demo/assets/js/options.js
    • Server side : demo/server.js

    Replace the placeholders with your LoginRadius credentials apikey, apisecret, sitename. These can be obtained from here

  4. Navigate to the demo directory, and run: node server.js

  5. Demo will appear on http://localhost:3000

About

The LoginRadius Node JS library will let you integrate LoginRadius' customer identity platform with your Node JS application(s).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%