LoginRadius ASP.NET 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.
This documentation presumes you have worked through the client-side implementation to setup your LoginRadius User Registration interfaces that will serve the initial registration and login process. Details on this can be found in the getting started guide.
**Note: **LoginRadius uses the industry standard TLS 1.2 protocol, designed to help protect the privacy of information communicated over the Internet. In order to use the LoginRadius .Net SDK, add the following code before instantiating your web service in your project's Global.asax
file.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
Download the User Registration .Net SDK from Github
Copy LoginRadiusSDK.V2.dll and LoginRadiusSDK.V2.pdb files into the References directory of your ASP.NET project.
OR
PM> Install-Package LoginRadiusSDK.NET
OR
Open the solution using Visual Studio 2019.
Build the project and note where the .nupkg file is located.
Access the NuGet Package Manager Settings and import the directory where the .nupkg file is located.
Access the "Manage NuGet Packages for Solutions..." tool change the source to the newly created source and select and install the LoginRadius SDK
Next, include the following namespaces in your project:
using LoginRadiusSDK.V2.Api;
using LoginRadiusSDK.V2.Models;
Before using the SDK, you must initialize the SDK with the help of following code: API Key and secret of your LoginRadius site. This information can be found in your LoginRadius account as described here
LoginRadiusSdkGlobalConfig.ApiKey = "__API_KEY__";
LoginRadiusSdkGlobalConfig.ApiSecret = "__API_SECRET__";
LoginRadiusSdkGlobalConfig.AppName = "__LoginRadius_APP_NAME__";
LoginRadiusSdkGlobalConfig.ApiRequestSigning ="false";
LoginRadiusSdkGlobalConfig.ConnectionTimeout = 30000; // Connection Timeout (milliseconds)
LoginRadiusSdkGlobalConfig.ProxyAddress = "__HTTP_PROXY_ADDRESS__"; // Absolute Proxy URI
LoginRadiusSdkGlobalConfig.ProxyCredentials = "__HTTP_PROXY_CREDENTIALS__"; // Proxy Credentials in the format 'USERNAME:PASSWORD'
LoginRadiusSdkGlobalConfig.RequestRetries = 3;
LoginRadiusSdkGlobalConfig.ApiRegion = "_region_";
LoginRadiusSdkGlobalConfig.DomainName = "https://api.loginradius.com/";
OR
For ASP.NET. in web.config
:
<configSections>
<section name="loginradius" type="LoginRadiusSDK.V2.SDKConfigHandler, LoginRadiusSDK.V2" />
</configSections>
<!-- LoginRadius SDK settings -->
<loginradius>
<settings>
<add name="apiKey" value="__API_KEY__" />
<add name="apiSecret" value="__API_SECRET__" />
<add name="appName" value="__LoginRadius_APP_NAME__"/>
<add name="ApiRequestSigning" value="false"/>
<add name="proxyAddress" value="__HTTP_PROXY_ADDRESS__" /> <!-- Absolute Proxy URI -->
<add name="proxyCredentials" value="__HTTP_PROXY_CREDENTIALS__" /> <!-- Proxy Credentials in the format 'USERNAME:PASSWORD' -->
<add name="connectionTimeout" value="__HTTP_CONNECTION_TIMEOUT__" /> <!-- Connection Timeout (milliseconds) -->
<add name="requestRetries" value="__HTTP_CONNECTION_RETRY__" />
<add name="apiRegion" value="_region_" />
<add name="domainName" value="https://api.loginradius.com/" />
</settings>
</loginradius>
OR
For .NET Core, in appsettings.json
:
JSON
"loginradius": {
"apiKey": "__API_KEY__",
"apiSecret": "__API_SECRET__",
"appName" : "__LoginRadius_APP_NAME__",
"ApiRequestSigning" : "false",
"proxyAddress" : "__HTTP_PROXY_ADDRESS__",
"proxyCredentials" : "__HTTP_PROXY_CREDENTIAL__",
"connectionTimeout" : "__HTTP_CONNECTION_TIMEOUT__",
"requestRetries" : "__HTTP_CONNECTION_RETRY__",
"apiRegion": "_region_",
"domainName" : "https://api.loginradius.com/"
}
When initializing the SDK, optionally specify a custom domain. Example : In appsettings.json, add following statement -
"domainName" : "https://api.loginradius.com/"
When initializing the SDK, you can optionally specify enabling this feature. Enabling this feature means the customer does not need to pass an API secret in an API request. Instead, they can pass a dynamically generated hash value. This feature will also make sure that the message is not tampered during transit when someone calls our APIs. Example : In appsettings.json, add following statement -
"ApiRequestSigning" : "false"
X-Origin-IP LoginRadius allows you 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-Address>"
List of APIs in this Section:
PUT : Auth Update Profile by Token
PUT : Auth Unlock Account by Access Token
PUT : Auth Verify Email By OTP
PUT : Auth Reset Password by Security Answer and Email
PUT : Auth Reset Password by Security Answer and Phone
PUT : Auth Reset Password by Security Answer and UserName
PUT : Auth Reset Password by Reset Token
PUT : Auth Reset Password by OTP
PUT : Auth Reset Password by OTP and UserName
PUT : Auth Change Password
POST : Auth Link Social Identities
POST : Auth Link Social Identities By Ping
PUT : Auth Set or Change UserName
PUT : Auth Resend Email Verification
POST : Auth Add Email
POST : Auth Login by Email
POST : Auth Login by Username
POST : Auth Forgot Password
POST : Auth User Registration by Email
POST : Auth User Registration By Captcha
GET : Get Security Questions By Email
GET : Get Security Questions By UserName
GET : Get Security Questions By Phone
GET : Get Security Questions By Access Token
GET : Auth Validate Access token
GET : Access Token Invalidate
GET : Access Token Info
GET : Auth Read all Profiles by Token
GET : Auth Send Welcome Email
GET : Auth Delete Account
GET : Get Profile By Ping
GET : Auth Check Email Availability
GET : Auth Verify Email
GET : Auth Social Identity
GET : Auth Check UserName Availability
GET : Auth Privacy Policy Accept
GET : Auth Privacy Policy History By Access Token
GET : Auth send verification Email for linking social profiles
DELETE : Auth Delete Account with Email Confirmation
DELETE : Auth Remove Email
DELETE : Auth Unlink Social Identities
This API is used to update the user's profile by passing the access_token. More Info
var accessToken = "accessToken"; //Required
UserProfileUpdateModel userProfileUpdateModel = new UserProfileUpdateModel{
FirstName ="<FirstName>",
LastName ="<LastName>"
}; //Required
var emailTemplate = "emailTemplate"; //Optional
string fields = null; //Optional
; //Optional
var smsTemplate = "smsTemplate"; //Optional
var verificationUrl = "verificationUrl"; //Optional
var isVoiceOtp = false; //Optional
var options = "options"; //Optional
var apiResponse = new AuthenticationApi().UpdateProfileByAccessToken(accessToken, userProfileUpdateModel, emailTemplate, fields, smsTemplate, verificationUrl, isVoiceOtp, options).Result;
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
UnlockProfileModel unlockProfileModel = new UnlockProfileModel{
G_recaptcha_response ="<G-recaptcha-response>"
}; //Required
var apiResponse = new AuthenticationApi().UnlockAccountByToken(accessToken, unlockProfileModel).Result;
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
EmailVerificationByOtpModel emailVerificationByOtpModel = new EmailVerificationByOtpModel{
Email ="<Email>",
Otp ="<Otp>"
}; //Required
string fields = null; //Optional
var url = "url"; //Optional
var welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional
var apiResponse = new AuthenticationApi().VerifyEmailByOTP(emailVerificationByOtpModel, fields, url, welcomeEmailTemplate).Result;
This API is used to reset password for the specified account by security question More Info
ResetPasswordBySecurityAnswerAndEmailModel resetPasswordBySecurityAnswerAndEmailModel = new ResetPasswordBySecurityAnswerAndEmailModel{
Email ="<Email>",
Password ="<Password>",
SecurityAnswer = new Dictionary<String,String>{
["QuestionID"] = "Answer"
}
}; //Required
var apiResponse = new AuthenticationApi().ResetPasswordBySecurityAnswerAndEmail(resetPasswordBySecurityAnswerAndEmailModel).Result;
This API is used to reset password for the specified account by security question More Info
ResetPasswordBySecurityAnswerAndPhoneModel resetPasswordBySecurityAnswerAndPhoneModel = new ResetPasswordBySecurityAnswerAndPhoneModel{
Password ="<Password>",
Phone ="<Phone>",
SecurityAnswer = new Dictionary<String,String>{
["QuestionID"] = "Answer"
}
}; //Required
var apiResponse = new AuthenticationApi().ResetPasswordBySecurityAnswerAndPhone(resetPasswordBySecurityAnswerAndPhoneModel).Result;
This API is used to reset password for the specified account by security question More Info
ResetPasswordBySecurityAnswerAndUserNameModel resetPasswordBySecurityAnswerAndUserNameModel = new ResetPasswordBySecurityAnswerAndUserNameModel{
Password ="<Password>",
SecurityAnswer = new Dictionary<String,String>{
["QuestionID"] = "Answer"
},
UserName ="<UserName>"
}; //Required
var apiResponse = new AuthenticationApi().ResetPasswordBySecurityAnswerAndUserName(resetPasswordBySecurityAnswerAndUserNameModel).Result;
This API is used to set a new password for the specified account. More Info
ResetPasswordByResetTokenModel resetPasswordByResetTokenModel = new ResetPasswordByResetTokenModel{
Password ="<Password>",
ResetToken ="<ResetToken>"
}; //Required
var apiResponse = new AuthenticationApi().ResetPasswordByResetToken(resetPasswordByResetTokenModel).Result;
This API is used to set a new password for the specified account. More Info
ResetPasswordByEmailAndOtpModel resetPasswordByEmailAndOtpModel = new ResetPasswordByEmailAndOtpModel{
Email ="<Email>",
Otp ="<Otp>",
Password ="<Password>"
}; //Required
var apiResponse = new AuthenticationApi().ResetPasswordByEmailOTP(resetPasswordByEmailAndOtpModel).Result;
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
ResetPasswordByUserNameModel resetPasswordByUserNameModel = new ResetPasswordByUserNameModel{
Otp ="<Otp>",
Password ="<Password>",
UserName ="<UserName>"
}; //Required
var apiResponse = new AuthenticationApi().ResetPasswordByOTPAndUserName(resetPasswordByUserNameModel).Result;
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
var apiResponse = new AuthenticationApi().ChangePassword(accessToken, newPassword, oldPassword).Result;
This API is used to link up a social provider account with the specified account based on the access token and the social providers user access token. More Info
var accessToken = "accessToken"; //Required
var candidateToken = "candidateToken"; //Required
var apiResponse = new AuthenticationApi().LinkSocialIdentities(accessToken, candidateToken).Result;
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
var apiResponse = new AuthenticationApi().LinkSocialIdentitiesByPing(accessToken, clientGuid).Result;
This API is used to set or change UserName by access token. More Info
var accessToken = "accessToken"; //Required
var username = "username"; //Required
var apiResponse = new AuthenticationApi().SetOrChangeUserName(accessToken, username).Result;
This API resends the verification email to the user. More Info
var email = "email"; //Required
var emailTemplate = "emailTemplate"; //Optional
var verificationUrl = "verificationUrl"; //Optional
var apiResponse = new AuthenticationApi().AuthResendEmailVerification(email, emailTemplate, verificationUrl).Result;
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
var apiResponse = new AuthenticationApi().AddEmail(accessToken, email, type, emailTemplate, verificationUrl).Result;
This API retrieves a copy of the user data based on the Email More Info
EmailAuthenticationModel emailAuthenticationModel = new EmailAuthenticationModel{
Email ="<Email>",
Password ="<Password>"
}; //Required
var emailTemplate = "emailTemplate"; //Optional
string fields = null; //Optional
var loginUrl = "loginUrl"; //Optional
var verificationUrl = "verificationUrl"; //Optional
var apiResponse = new AuthenticationApi().LoginByEmail(emailAuthenticationModel, emailTemplate, fields, loginUrl, verificationUrl).Result;
This API retrieves a copy of the user data based on the Username More Info
UserNameAuthenticationModel userNameAuthenticationModel = new UserNameAuthenticationModel{
Password ="<Password>",
Username ="<Username>"
}; //Required
var emailTemplate = "emailTemplate"; //Optional
string fields = null; //Optional
var loginUrl = "loginUrl"; //Optional
var verificationUrl = "verificationUrl"; //Optional
var apiResponse = new AuthenticationApi().LoginByUserName(userNameAuthenticationModel, emailTemplate, fields, loginUrl, verificationUrl).Result;
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
var apiResponse = new AuthenticationApi().ForgotPassword(email, resetPasswordUrl, emailTemplate).Result;
This API creates a user in the database as well as sends a verification email to the user. More Info