https://github.com/loginradius/node-js-sdk
The LoginRadius Node JS library will let you integrate LoginRadius' customer identity platform with your Node JS application(s).
https://github.com/loginradius/node-js-sdk
customer-identity hacktoberfest loginradius loginradius-platform nodejs-sdk social-login wrapper-library
Last synced: 10 months ago
JSON representation
The LoginRadius Node JS library will let you integrate LoginRadius' customer identity platform with your Node JS application(s).
- Host: GitHub
- URL: https://github.com/loginradius/node-js-sdk
- Owner: LoginRadius
- License: mit
- Created: 2012-09-26T01:17:54.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-05-20T20:21:52.000Z (over 2 years ago)
- Last Synced: 2024-04-14T01:50:38.644Z (almost 2 years ago)
- Topics: customer-identity, hacktoberfest, loginradius, loginradius-platform, nodejs-sdk, social-login, wrapper-library
- Language: JavaScript
- Homepage: https://www.loginradius.com
- Size: 4.8 MB
- Stars: 9
- Watchers: 7
- Forks: 23
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Node-js-sdk-v2
Customer Identity public repo for Node.js V2 SDK, based on LoginRadius V2 APIs.

## 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](http://www.loginradius.com/) 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](http://github.com/LoginRadius/node-js-sdk)
Note: The latest version(11.7.0) of Node js SDK works with LoginRadius V2 APIs.
Installation
run `npm install loginradius-sdk`
Configuration
Create `var config` in project
```js
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](https://www.loginradius.com/docs/api/v2/admin-console/platform-security/api-key-and-secret)
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.
```js
originIp:"{{ Client Ip }}"
```
The originIp will be added in `var config`
### Implementation
Require the loginradius-sdk package and pass the config object.
```js
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:
* PUT : [Auth Update Profile by Token](#UpdateProfileByAccessToken-put-)
* PUT : [Auth Unlock Account by Access Token](#UnlockAccountByToken-put-)
* PUT : [Auth Verify Email By OTP](#VerifyEmailByOTP-put-)
* PUT : [Auth Reset Password by Security Answer and Email](#ResetPasswordBySecurityAnswerAndEmail-put-)
* PUT : [Auth Reset Password by Security Answer and Phone](#ResetPasswordBySecurityAnswerAndPhone-put-)
* PUT : [Auth Reset Password by Security Answer and UserName](#ResetPasswordBySecurityAnswerAndUserName-put-)
* PUT : [Auth Reset Password by Reset Token](#ResetPasswordByResetToken-put-)
* PUT : [Auth Reset Password by OTP](#ResetPasswordByEmailOTP-put-)
* PUT : [Auth Reset Password by OTP and UserName](#ResetPasswordByOTPAndUserName-put-)
* PUT : [Auth Change Password](#ChangePassword-put-)
* PUT : [Auth Set or Change UserName](#SetOrChangeUserName-put-)
* PUT : [Auth Resend Email Verification](#AuthResendEmailVerification-put-)
* POST : [Auth Add Email](#AddEmail-post-)
* POST : [Auth Login by Email](#LoginByEmail-post-)
* POST : [Auth Login by Username](#LoginByUserName-post-)
* POST : [Auth Forgot Password](#ForgotPassword-post-)
* POST : [Auth Link Social Identities](#LinkSocialIdentities-post-)
* POST : [Auth Link Social Identities By Ping](#LinkSocialIdentitiesByPing-post-)
* POST : [Auth User Registration by Email](#UserRegistrationByEmail-post-)
* POST : [Auth User Registration By Captcha](#UserRegistrationByCaptcha-post-)
* GET : [Get Security Questions By Email](#GetSecurityQuestionsByEmail-get-)
* GET : [Get Security Questions By UserName](#GetSecurityQuestionsByUserName-get-)
* GET : [Get Security Questions By Phone](#GetSecurityQuestionsByPhone-get-)
* GET : [Get Security Questions By Access Token](#GetSecurityQuestionsByAccessToken-get-)
* GET : [Auth Validate Access token](#AuthValidateAccessToken-get-)
* GET : [Access Token Invalidate](#AuthInValidateAccessToken-get-)
* GET : [Access Token Info](#GetAccessTokenInfo-get-)
* GET : [Auth Read all Profiles by Token](#GetProfileByAccessToken-get-)
* GET : [Auth Send Welcome Email](#SendWelcomeEmail-get-)
* GET : [Auth Delete Account](#DeleteAccountByDeleteToken-get-)
* GET : [Get Profile By Ping](#GetProfileByPing-get-)
* GET : [Auth Check Email Availability](#CheckEmailAvailability-get-)
* GET : [Auth Verify Email](#VerifyEmail-get-)
* GET : [Auth Check UserName Availability](#CheckUserNameAvailability-get-)
* GET : [Auth Privacy Policy Accept](#AcceptPrivacyPolicy-get-)
* GET : [Auth Privacy Policy History By Access Token](#GetPrivacyPolicyHistoryByAccessToken-get-)
* GET : [Auth send verification Email for linking social profiles](#AuthSendVerificationEmailForLinkingSocialProfiles-get-)
* DELETE : [Auth Delete Account with Email Confirmation](#DeleteAccountWithEmailConfirmation-delete-)
* DELETE : [Auth Remove Email](#RemoveEmail-delete-)
* DELETE : [Auth Unlink Social Identities](#UnlinkSocialIdentities-delete-)
Auth Update Profile by Token (PUT)
This API is used to update the user's profile by passing the access token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-update-profile-by-token/)
```js
var accessToken = ""; //Required
var userProfileUpdateModel ={
"firstName" : "",
"lastName" : ""
}; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var nullSupport = true; //Optional
var smsTemplate = ""; //Optional
var verificationUrl = ""; //Optional
var isVoiceOtp = true; //Optional
var options = ""; //Optional
lrv2.authenticationApi.updateProfileByAccessToken(accessToken, userProfileUpdateModel, emailTemplate, fields, nullSupport, smsTemplate, verificationUrl, isVoiceOtp, options).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-unlock-account-by-access-token/)
```js
var accessToken = ""; //Required
var unlockProfileModel ={
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-verify-email-by-otp/)
```js
var emailVerificationByOtpModel ={
"email" : "",
"otp" : ""
}; //Required
var fields = null; //Optional
var url = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-reset-password-by-email)
```js
var resetPasswordBySecurityAnswerAndEmailModel ={
"email" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-reset-password-by-phone)
```js
var resetPasswordBySecurityAnswerAndPhoneModel ={
"password" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-reset-password-by-username)
```js
var resetPasswordBySecurityAnswerAndUserNameModel ={
"password" : "",
"securityAnswer" : {"QuestionID":"Answer"},
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-reset-password-by-reset-token)
```js
var resetPasswordByResetTokenModel ={
"password" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-reset-password-by-otp)
```js
var resetPasswordByEmailAndOtpModel ={
"email" : "",
"otp" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-reset-password-by-otp-and-username/)
```js
var resetPasswordByUserNameModel ={
"otp" : "",
"password" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-change-password)
```js
var accessToken = ""; //Required
var newPassword = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-set-or-change-user-name/)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-resend-email-verification/)
```js
var email = ""; //Required
var emailTemplate = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-add-email)
```js
var accessToken = ""; //Required
var email = ""; //Required
var type = ""; //Required
var emailTemplate = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-login-by-email)
```js
var emailAuthenticationModel ={
"email" : "",
"password" : ""
}; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var loginUrl = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-login-by-username)
```js
var userNameAuthenticationModel ={
"password" : "",
"username" : ""
}; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var loginUrl = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-forgot-password)
```js
var email = ""; //Required
var resetPasswordUrl = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-link-social-identities)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-link-social-identities-by-ping)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-user-registration-by-email)
```js
var authUserRegistrationModel ={
"email" : [ {
"type" : "" ,
"value" : ""
} ] ,
"firstName" : "",
"lastName" : "",
"password" : ""
}; //Required
var sott = ""; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var options = ""; //Optional
var verificationUrl = ""; //Optional
var welcomeEmailTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.authenticationApi.userRegistrationByEmail(authUserRegistrationModel, sott, emailTemplate, fields, options, verificationUrl, welcomeEmailTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-user-registration-by-recaptcha)
```js
var authUserRegistrationModelWithCaptcha ={
"email" : [ {
"type" : "" ,
"value" : ""
} ] ,
"firstName" : "",
"g-recaptcha-response" : "",
"lastName" : "",
"password" : ""
}; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var options = ""; //Optional
var smsTemplate = ""; //Optional
var verificationUrl = ""; //Optional
var welcomeEmailTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.authenticationApi.userRegistrationByCaptcha(authUserRegistrationModelWithCaptcha, emailTemplate, fields, options, smsTemplate, verificationUrl, welcomeEmailTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/security-questions-by-email/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/security-questions-by-user-name/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/security-questions-by-phone/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/security-questions-by-access-token/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-validate-access-token/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-invalidate-access-token/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-access-token-info/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-read-profiles-by-token/)
```js
var accessToken = ""; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var verificationUrl = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-send-welcome-email/)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-delete-account/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/social-login-by-ping/)
```js
var clientGuid = ""; //Required
var emailTemplate = ""; //Optional
var fields = null; //Optional
var verificationUrl = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-email-availability/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-verify-email/)
```js
var verificationToken = ""; //Required
var fields = null; //Optional
var url = ""; //Optional
var welcomeEmailTemplate = ""; //Optional
var uuid = ""; //Optional
lrv2.authenticationApi.verifyEmail(verificationToken, fields, url, welcomeEmailTemplate, uuid).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-username-availability/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-privacy-policy-accept)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/privacy-policy-history-by-access-token/)
```js
var accessToken = ""; //Required
lrv2.authenticationApi.getPrivacyPolicyHistoryByAccessToken(accessToken).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
Auth send verification Email for linking social profiles (GET)
This API is used to Send verification email to the unverified email of the social profile. This API can be used only incase of optional verification workflow. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-send-verification-for-social-email/)
```js
var accessToken = ""; //Required
var clientguid = ""; //Required
lrv2.authenticationApi.authSendVerificationEmailForLinkingSocialProfiles(accessToken, clientguid).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-delete-account-with-email-confirmation/)
```js
var accessToken = ""; //Required
var deleteUrl = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-remove-email)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-unlink-social-identities)
```js
var accessToken = ""; //Required
var provider = ""; //Required
var 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:
* PUT : [Account Update](#UpdateAccountByUid-put-)
* PUT : [Update Phone ID by UID](#UpdatePhoneIDByUid-put-)
* PUT : [Account Set Password](#SetAccountPasswordByUid-put-)
* PUT : [Account Invalidate Verification Email](#InvalidateAccountEmailVerification-put-)
* PUT : [Reset phone ID verification](#ResetPhoneIDVerificationByUid-put-)
* PUT : [Upsert Email](#UpsertEmail-put-)
* PUT : [Update UID](#AccountUpdateUid-put-)
* POST : [Account Create](#CreateAccount-post-)
* POST : [Forgot Password token](#GetForgotPasswordToken-post-)
* POST : [Email Verification token](#GetEmailVerificationToken-post-)
* POST : [Multipurpose Email Token Generation API](#MultipurposeEmailTokenGeneration-post-)
* POST : [Multipurpose SMS OTP Generation API](#MultipurposeSMSOTPGeneration-post-)
* GET : [Get Privacy Policy History By Uid](#GetPrivacyPolicyHistoryByUid-get-)
* GET : [Account Profiles by Email](#GetAccountProfileByEmail-get-)
* GET : [Account Profiles by Username](#GetAccountProfileByUserName-get-)
* GET : [Account Profile by Phone ID](#GetAccountProfileByPhone-get-)
* GET : [Account Profiles by UID](#GetAccountProfileByUid-get-)
* GET : [Account Password](#GetAccountPasswordHashByUid-get-)
* GET : [Access Token based on UID or User impersonation API](#GetAccessTokenByUid-get-)
* GET : [Refresh Access Token by Refresh Token](#RefreshAccessTokenByRefreshToken-get-)
* GET : [Revoke Refresh Token](#RevokeRefreshToken-get-)
* GET : [Account Identities by Email](#GetAccountIdentitiesByEmail-get-)
* DELETE : [Account Delete](#DeleteAccountByUid-delete-)
* DELETE : [Account Remove Email](#RemoveEmail-delete-)
* DELETE : [Revoke All Refresh Token](#RevokeAllRefreshToken-delete-)
* DELETE : [Delete User Profiles By Email](#AccountDeleteByEmail-delete-)
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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-update)
```js
var accountUserProfileUpdateModel ={
"firstName" : "",
"lastName" : ""
}; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/update-phoneid-by-uid)
```js
var phone = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-set-password)
```js
var password = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-invalidate-verification-email)
```js
var uid = ""; //Required
var emailTemplate = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/reset-phone-id-verification)
```js
var uid = ""; //Required
var smsTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.accountApi.resetPhoneIDVerificationByUid(uid, smsTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/upsert-email)
```js
var upsertEmailModel ={
"email" : [ {
"type" : "" ,
"value" : ""
} ]
}; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-update/)
```js
var updateUidModel ={
"newUid" : ""
}; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-create)
```js
var accountCreateModel ={
"email" : [ {
"type" : "" ,
"value" : ""
} ] ,
"firstName" : "",
"lastName" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/get-forgot-password-token)
```js
var email = ""; //Required
var emailTemplate = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/get-email-verification-token)
```js
var email = ""; //Required
lrv2.accountApi.getEmailVerificationToken(email).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
Multipurpose Email Token Generation API (POST)
This API generate Email tokens and Email OTPs for Email verification, Add email, Forgot password, Delete user, Passwordless login, Forgot pin, One-touch login and Auto login. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/multipurpose-token-and-sms-otp-generation-api/multipurpose-email-token-generation/)
```Js
var multiEmailToken ={
"clientguid" : "",
"email" : "",
"name" : "",
"type" : "",
"uid" : "",
"userName" : ""
}; //Required
var tokentype = ""; //Required
lrv2.accountApi.multipurposeEmailTokenGeneration(multiEmailToken, tokentype).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
Multipurpose SMS OTP Generation API (POST)
This API generates SMS OTP for Add phone, Phone Id verification, Forgot password, Forgot pin, One-touch login, smart login and Passwordless login. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/multipurpose-token-and-sms-otp-generation-api/multipurpose-sms-otp-generation/)
```Js
var multiSmsOtp ={
"name" : "",
"phone" : "",
"uid" : ""
}; //Required
var smsotptype = ""; //Required
lrv2.accountApi.multipurposeSMSOTPGeneration(multiSmsOtp, smsotptype).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/privacy-policy-history-by-uid/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-profiles-by-email)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-profiles-by-user-name)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-profiles-by-phone-id/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-profiles-by-uid)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-password)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-impersonation-api)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/refresh-token/refresh-access-token-by-refresh-token)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/refresh-token/revoke-refresh-token)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-identities-by-email)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-delete)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-email-delete)
```js
var email = ""; //Required
var uid = ""; //Required
var fields = null; //Optional
lrv2.accountApi.removeEmail(email, uid, fields).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
Revoke All Refresh Token (DELETE)
The Revoke All Refresh Access Token API is used to revoke all refresh tokens for a specific user. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/refresh-token/revoke-all-refresh-token/)
```js
var uid = ""; //Required
lrv2.accountApi.revokeAllRefreshToken(uid).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-email-delete/)
```js
var email = ""; //Required
lrv2.accountApi.accountDeleteByEmail(email).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
### Social API
List of APIs in this Section:
* GET : [Access Token](#ExchangeAccessToken-get-)
* GET : [Refresh Token](#RefreshAccessToken-get-)
* GET : [Token Validate](#ValidateAccessToken-get-)
* GET : [Access Token Invalidate](#InValidateAccessToken-get-)
* GET : [Get Active Session Details](#GetActiveSession-get-)
* GET : [Get Active Session By Account Id](#GetActiveSessionByAccountID-get-)
* GET : [Get Active Session By Profile Id](#GetActiveSessionByProfileID-get-)
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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/access-token)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/refresh-token/refresh-token)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/validate-access-token)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/invalidate-access-token)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/advanced-social-api/get-active-session-details)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/active-session-by-account-id/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/active-session-by-profile-id/)
```js
var profileId = ""; //Required
lrv2.socialApi.getActiveSessionByProfileID(profileId).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
### CustomObject API
List of APIs in this Section:
* PUT : [Custom Object Update by Access Token](#UpdateCustomObjectByToken-put-)
* PUT : [Custom Object Update by UID](#UpdateCustomObjectByUid-put-)
* POST : [Create Custom Object by Token](#CreateCustomObjectByToken-post-)
* POST : [Create Custom Object by UID](#CreateCustomObjectByUid-post-)
* GET : [Custom Object by Token](#GetCustomObjectByToken-get-)
* GET : [Custom Object by ObjectRecordId and Token](#GetCustomObjectByRecordIDAndToken-get-)
* GET : [Custom Object By UID](#GetCustomObjectByUid-get-)
* GET : [Custom Object by ObjectRecordId and UID](#GetCustomObjectByRecordID-get-)
* DELETE : [Custom Object Delete by Record Id And Token](#DeleteCustomObjectByToken-delete-)
* DELETE : [Account Delete Custom Object by ObjectRecordId](#DeleteCustomObjectByRecordID-delete-)
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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-update-by-objectrecordid-and-token)
```js
var accessToken = ""; //Required
var objectName = ""; //Required
var objectRecordId = ""; //Required
var object = { "customdata1": "Store my customdata1 value" }; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-update-by-objectrecordid-and-uid)
```js
var objectName = ""; //Required
var objectRecordId = ""; //Required
var object = { "customdata1": "Store my customdata1 value" }; //Required
var uid = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/create-custom-object-by-token)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/create-custom-object-by-uid)
```js
var objectName = ""; //Required
var object = { "customdata1": "Store my customdata1 value" }; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-by-token)
```js
var accessToken = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-by-objectrecordid-and-token)
```js
var accessToken = ""; //Required
var objectName = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-by-uid)
```js
var objectName = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-by-objectrecordid-and-uid)
```js
var objectName = ""; //Required
var objectRecordId = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-delete-by-objectrecordid-and-token)
```js
var accessToken = ""; //Required
var objectName = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-object/custom-object-delete-by-objectrecordid-and-uid)
```js
var objectName = ""; //Required
var objectRecordId = ""; //Required
var 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:
* PUT : [Phone Reset Password by OTP](#ResetPasswordByPhoneOTP-put-)
* PUT : [Phone Verification OTP](#PhoneVerificationByOTP-put-)
* PUT : [Phone Verification OTP by Token](#PhoneVerificationOTPByAccessToken-put-)
* PUT : [Phone Number Update](#UpdatePhoneNumber-put-)
* POST : [Phone Login](#LoginByPhone-post-)
* POST : [Phone Forgot Password by OTP](#ForgotPasswordByPhoneOTP-post-)
* POST : [Phone Resend Verification OTP](#PhoneResendVerificationOTP-post-)
* POST : [Phone Resend Verification OTP By Token](#PhoneResendVerificationOTPByToken-post-)
* POST : [Phone User Registration by SMS](#UserRegistrationByPhone-post-)
* GET : [Phone Number Availability](#CheckPhoneNumberAvailability-get-)
* DELETE : [Remove Phone ID by Access Token](#RemovePhoneIDByAccessToken-delete-)
Phone Reset Password by OTP (PUT)
This API is used to reset the password [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-reset-password-by-otp)
```js
var resetPasswordByOTPModel ={
"otp" : "",
"password" : "",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-verify-otp)
```js
var otp = ""; //Required
var phone = ""; //Required
var fields = null; //Optional
var smsTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.phoneAuthenticationApi.phoneVerificationByOTP(otp, phone, fields, smsTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-verify-otp-by-token)
```js
var accessToken = ""; //Required
var otp = ""; //Required
var smsTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.phoneAuthenticationApi.phoneVerificationOTPByAccessToken(accessToken, otp, smsTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-number-update)
```js
var accessToken = ""; //Required
var phone = ""; //Required
var smsTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.phoneAuthenticationApi.updatePhoneNumber(accessToken, phone, smsTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-login)
```js
var phoneAuthenticationModel ={
"password" : "",
"phone" : ""
}; //Required
var fields = null; //Optional
var loginUrl = ""; //Optional
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-forgot-password-by-otp)
```js
var phone = ""; //Required
var smsTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.phoneAuthenticationApi.forgotPasswordByPhoneOTP(phone, smsTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-resend-otp)
```js
var phone = ""; //Required
var smsTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.phoneAuthenticationApi.phoneResendVerificationOTP(phone, smsTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-resend-otp-by-token)
```js
var accessToken = ""; //Required
var phone = ""; //Required
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-user-registration-by-sms)
```js
var authUserRegistrationModel ={
"firstName" : "",
"lastName" : "",
"password" : "",
"phoneId" : ""
}; //Required
var sott = ""; //Required
var fields = null; //Optional
var options = ""; //Optional
var smsTemplate = ""; //Optional
var verificationUrl = ""; //Optional
var welcomeEmailTemplate = ""; //Optional
var emailTemplate = ""; //Optional
var isVoiceOtp = true; //Optional
lrv2.phoneAuthenticationApi.userRegistrationByPhone(authUserRegistrationModel, sott, fields, options, smsTemplate, verificationUrl, welcomeEmailTemplate, emailTemplate, isVoiceOtp).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-number-availability)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/remove-phone-id-by-access-token)
```js
var accessToken = ""; //Required
lrv2.phoneAuthenticationApi.removePhoneIDByAccessToken(accessToken).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
});
```
### MultiFactorAuthentication API
List of APIs in this Section:
* PUT : [Update MFA Setting](#MFAUpdateSetting-put-)
* PUT : [MFA Update Phone Number by Token](#MFAUpdatePhoneNumberByToken-put-)
* PUT : [Verify MFA Email OTP by Access Token](#MFAValidateEmailOtpByAccessToken-put-)
* PUT : [Update MFA Security Question by Access Token](#MFASecurityQuestionAnswerByAccessToken-put-)
* PUT : [MFA Validate OTP](#MFAValidateOTPByPhone-put-)
* PUT : [MFA Validate Backup code](#MFAValidateBackupCode-put-)
* PUT : [MFA Update Phone Number](#MFAUpdatePhoneNumber-put-)
* PUT : [Verify MFA Email OTP by MFA Token](#MFAValidateEmailOtp-put-)
* PUT : [Update MFA Security Question by MFA Token](#MFASecurityQuestionAnswer-put-)
* PUT : [MFA Validate Authenticator Code](#MFAValidateAuthenticatorCode-put-)
* PUT : [MFA Verify Authenticator Code](#MFAVerifyAuthenticatorCode-put-)
* POST : [MFA Email Login](#MFALoginByEmail-post-)
* POST : [MFA UserName Login](#MFALoginByUserName-post-)
* POST : [MFA Phone Login](#MFALoginByPhone-post-)
* POST : [Send MFA Email OTP by MFA Token](#MFAEmailOTP-post-)
* POST : [Verify MFA Security Question by MFA Token](#MFASecurityQuestionAnswerVerification-post-)
* GET : [MFA Validate Access Token](#MFAConfigureByAccessToken-get-)
* GET : [MFA Backup Code by Access Token](#MFABackupCodeByAccessToken-get-)
* GET : [Reset Backup Code by Access Token](#MFAResetBackupCodeByAccessToken-get-)
* GET : [Send MFA Email OTP by Access Token](#MFAEmailOtpByAccessToken-get-)
* GET : [MFA Resend Otp](#MFAResendOTP-get-)
* GET : [MFA Backup Code by UID](#MFABackupCodeByUid-get-)
* GET : [MFA Reset Backup Code by UID](#MFAResetBackupCodeByUid-get-)
* DELETE : [MFA Reset Authenticator by Token](#MFAResetAuthenticatorByToken-delete-)
* DELETE : [MFA Reset SMS Authenticator by Token](#MFAResetSMSAuthByToken-delete-)
* DELETE : [Reset MFA Email OTP Authenticator By Access Token](#MFAResetEmailOtpAuthenticatorByAccessToken-delete-)
* DELETE : [MFA Reset Security Question Authenticator By Access Token](#MFAResetSecurityQuestionAuthenticatorByAccessToken-delete-)
* DELETE : [MFA Reset SMS Authenticator By UID](#MFAResetSMSAuthenticatorByUid-delete-)
* DELETE : [MFA Reset Authenticator By UID](#MFAResetAuthenticatorByUid-delete-)
* DELETE : [Reset MFA Email OTP Authenticator Settings by Uid](#MFAResetEmailOtpAuthenticatorByUid-delete-)
* DELETE : [Reset MFA Security Question Authenticator Settings by Uid](#MFAResetSecurityQuestionAuthenticatorByUid-delete-)
Update MFA Setting (PUT)
This API is used to trigger the Multi-factor authentication settings after login for secure actions [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/sms-authenticator/update-mfa-setting/)
```js
var accessToken = ""; //Required
var multiFactorAuthModelWithLockout ={
"otp" : ""
}; //Required
var fields = null; //Optional
lrv2.multiFactorAuthenticationApi.mfaUpdateSetting(accessToken, multiFactorAuthModelWithLockout, fields).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/sms-authenticator/mfa-update-phone-number-by-token/)
```js
var accessToken = ""; //Required
var phoneNo2FA = ""; //Required
var smsTemplate2FA = ""; //Optional
var isVoiceOtp = true; //Optional
var options = ""; //Optional
lrv2.multiFactorAuthenticationApi.mfaUpdatePhoneNumberByToken(accessToken, phoneNo2FA, smsTemplate2FA, isVoiceOtp,options).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](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/verify-mfa-otp-by-access-token/)
```js
var 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/update-mfa-security-question-by-access-token)
```js
var accessToken = ""; //Required
var securityQuestionAnswerModelByAccessToken ={
"securityquestionanswer": [
{
"QuestionId": "db7****8a73e4******bd9****8c20",
"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](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/sms-authenticator/mfa-validate-otp/)
```js
var multiFactorAuthModelWithLockout ={
"otp" : ""
}; //Required
var secondFactorAuthenticationToken = ""; //Required
var fields = null; //Optional
var smsTemplate2FA = ""; //Optional
var rbaBrowserEmailTemplate = ""; //Optional
var rbaCityEmailTemplate = ""; //Optional
var rbaCountryEmailTemplate = ""; //Optional
var 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 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/backup-codes/mfa-validate-backup-code/)
```js
var multiFactorAuthModelByBackupCode ={
"backupCode" : ""
}; //Required
var secondFactorAuthenticationToken = ""; //Required
var fields = null; //Optional
var rbaBrowserEmailTemplate = ""; //Optional
var rbaCityEmailTemplate = "