Python Library
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.
This document contains information and examples regarding the LoginRadius Python SDK. It provides guidance for working with social authentication, user profile data, and auth implementation with a variety of social networks such as Facebook, Google, Twitter. You can get the SDK from here
Installation
Install From Package
Using pip
pip install loginradius-v2==10.0.1
or with easy_install:
easy_install loginradius-v2==10.0.1
Install From Source
You can download the latest version from PyPI
- Unzip/untar the files.
- Browse to the directory that you extracted the files to.
- Run python setup.py install to install the LoginRadius module.
Requests library
To call API's, install requests library.
Using pip
pip install requests
or with easy_install
easy_install requests
Setup Your Dashboard
Get your API credentials to initialize SDK and whitelist your application domain as explained in this section.
Configuration
Initialize SDK
Import the class
from LoginRadius import LoginRadius as LR
- When your Python application initializes, set your API Key and Secret:
LR.API_KEY = "<API-KEY>"
LR.API_SECRET = "<API-SECRET>"
loginradius = LR()
- To enable API request signing, set the value of 'API_REQUEST_SIGNING' to True
Create login_radius.rb in /config/initializers:
LR.API_REQUEST_SIGNING = True
For more details check API Refrence Here
API Details
Authentication API
List of APIs in this Section:
- PUT : Auth Update Profile by Token
- PUT : Auth Verify Email By OTP
- PUT : Auth Reset Password by Reset Token
- PUT : Auth Change Password
- PUT : Auth Resend Email Verification
- POST : Auth Add Email
- POST : Auth Login by Email
- POST : Auth Forgot Password
- POST : Auth User Registration by Email
- POST : Auth User Registration By Captcha
- 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 : Auth Check Email Availability
- GET : Auth Verify Email
- GET : Auth Social Identity
- GET : Auth Privacy Policy Accept
- DELETE : Auth Delete Account with Email Confirmation
- DELETE : Auth Remove Email
Auth Update Profile by Token (PUT)
This API is used to update the user's profile by passing the access token.
access_token = "<access_token>" #Required
user_profile_update_model = {
"firstName" : "<firstName>",
"lastName" : "<lastName>"
} #Required
email_template = "<email_template>" #Optional
fields = "<fields>" #Optional
null_support = "True" #Optional
sms_template = "<sms_template>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.authentication.update_profile_by_access_token(access_token, user_profile_update_model, email_template, fields, null_support, sms_template, verification_url)
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.
email_verification_by_otp_model = {
"email" : "<email>",
"otp" : "<otp>"
} #Required
fields = "<fields>" #Optional
url = "<url>" #Optional
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.authentication.verify_email_by_otp(email_verification_by_otp_model, fields, url, welcome_email_template)
Auth Reset Password by Reset Token (PUT)
This API is used to set a new password for the specified account.
reset_password_by_reset_token_model = {
"password" : "<password>",
"resetToken" : "<resetToken>"
} #Required
result = loginradius.authentication.reset_password_by_reset_token(reset_password_by_reset_token_model)
Auth Change Password (PUT)
This API is used to change the accounts password based on the previous password
access_token = "<access_token>" #Required
new_password = "<new_password>" #Required
old_password = "<old_password>" #Required
result = loginradius.authentication.change_password(access_token, new_password, old_password)
Auth Resend Email Verification (PUT)
This API resends the verification email to the user.
email = "<email>" #Required
email_template = "<email_template>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.authentication.auth_resend_email_verification(email, email_template, verification_url)
Auth Add Email (POST)
This API is used to add additional emails to a user's account.
access_token = "<access_token>" #Required
email = "<email>" #Required
type = "<type>" #Required
email_template = "<email_template>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.authentication.add_email(access_token, email, type, email_template, verification_url)
Auth Login by Email (POST)
This API retrieves a copy of the user data based on the Email
email_authentication_model = {
"email" : "<email>",
"password" : "<password>"
} #Required
email_template = "<email_template>" #Optional
fields = "<fields>" #Optional
login_url = "<login_url>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.authentication.login_by_email(email_authentication_model, email_template, fields, login_url, verification_url)
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'
email = "<email>" #Required
reset_password_url = "<reset_password_url>" #Required
email_template = "<email_template>" #Optional
result = loginradius.authentication.forgot_password(email, reset_password_url, email_template)
Auth User Registration by Email (POST)
This API creates a user in the database as well as sends a verification email to the user.
auth_user_registration_model = {
"email" : [ {
"type" : "<type>" ,
"value" : "<value>"
} ] ,
"firstName" : "<firstName>",
"lastName" : "<lastName>",
"password" : "<password>"
} #Required
sott = "<sott>" #Required
email_template = "<email_template>" #Optional
fields = "<fields>" #Optional
options = "<options>" #Optional
verification_url = "<verification_url>" #Optional
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.authentication.user_registration_by_email(auth_user_registration_model, sott, email_template, fields, options, verification_url, welcome_email_template)
Auth User Registration By Captcha (POST)
This API creates a user in the database as well as sends a verification email to the user.
auth_user_registration_model_with_captcha = {
"email" : [ {
"type" : "<type>" ,
"value" : "<value>"
} ] ,
"firstName" : "<firstName>",
"g-recaptcha-response" : "<g-recaptcha-response>",
"lastName" : "<lastName>",
"password" : "<password>"
} #Required
email_template = "<email_template>" #Optional
fields = "<fields>" #Optional
options = "<options>" #Optional
sms_template = "<sms_template>" #Optional
verification_url = "<verification_url>" #Optional
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.authentication.user_registration_by_captcha(auth_user_registration_model_with_captcha, email_template, fields, options, sms_template, verification_url, welcome_email_template)
Auth Validate Access token (GET)
This api validates access token, if valid then returns a response with its expiry otherwise error.
access_token = "<access_token>" #Required
result = loginradius.authentication.auth_validate_access_token(access_token)
Access Token Invalidate (GET)
This api call invalidates the active access token or expires an access token's validity.
access_token = "<access_token>" #Required
prevent_refresh = "True" #Optional
result = loginradius.authentication.auth_in_validate_access_token(access_token, prevent_refresh)
Access Token Info (GET)
This api call provide the active access token Information
access_token = "<access_token>" #Required
result = loginradius.authentication.get_access_token_info(access_token)
Auth Read all Profiles by Token (GET)
This API retrieves a copy of the user data based on the access token.
access_token = "<access_token>" #Required
fields = "<fields>" #Optional
result = loginradius.authentication.get_profile_by_access_token(access_token, fields)
Auth Send Welcome Email (GET)
This API sends a welcome email
access_token = "<access_token>" #Required
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.authentication.send_welcome_email(access_token, welcome_email_template)
Auth Delete Account (GET)
This API is used to delete an account by passing it a delete token.
deletetoken = "<deletetoken>" #Required
result = loginradius.authentication.delete_account_by_delete_token(deletetoken)
Auth Check Email Availability (GET)
This API is used to check the email exists or not on your site.
email = "<email>" #Required
result = loginradius.authentication.check_email_availability(email)
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'.
verification_token = "<verification_token>" #Required
fields = "<fields>" #Optional
url = "<url>" #Optional
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.authentication.verify_email(verification_token, fields, url, welcome_email_template)
Auth Social Identity (GET)
This API is called just after account linking API and it prevents the raas profile of the second account from getting created.
access_token = "<access_token>" #Required
fields = "<fields>" #Optional
result = loginradius.authentication.get_social_identity(access_token, fields)
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
access_token = "<access_token>" #Required
fields = "<fields>" #Optional
result = loginradius.authentication.accept_privacy_policy(access_token, fields)
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
access_token = "<access_token>" #Required
delete_url = "<delete_url>" #Optional
email_template = "<email_template>" #Optional
result = loginradius.authentication.delete_account_with_email_confirmation(access_token, delete_url, email_template)
Auth Remove Email (DELETE)
This API is used to remove additional emails from a user's account.
access_token = "<access_token>" #Required
email = "<email>" #Required
result = loginradius.authentication.remove_email(access_token, email)
Account API
List of APIs in this Section:
- PUT : Account Update
- PUT : Update Phone ID by UID
- PUT : Account Set Password
- PUT : Account Invalidate Verification Email
- PUT : Reset phone ID verification
- PUT : Upsert Email
- PUT : Update UID
- POST : Account Create
- POST : Forgot Password token
- POST : Email Verification token
- GET : Account Profiles by Email
- GET : Account Profile by Phone ID
- GET : Account Profiles by UID
- GET : Account Password
- GET : Access Token based on UID or User impersonation API
- GET : Account Identities by Email
- DELETE : Account Delete
- DELETE : Account Remove Email
- DELETE : Delete User Profiles By Email
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.
account_user_profile_update_model = {
"firstName" : "<firstName>",
"lastName" : "<lastName>"
} #Required
uid = "<uid>" #Required
fields = "<fields>" #Optional
null_support = "True" #Optional
result = loginradius.account.update_account_by_uid(account_user_profile_update_model, uid, fields, null_support)
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.
phone = "<phone>" #Required
uid = "<uid>" #Required
fields = "<fields>" #Optional
result = loginradius.account.update_phone_id_by_uid(phone, uid, fields)
Account Set Password (PUT)
This API is used to set the password of an account in Cloud Storage.
password = "<password>" #Required
uid = "<uid>" #Required
result = loginradius.account.set_account_password_by_uid(password, uid)
Account Invalidate Verification Email (PUT)
This API is used to invalidate the Email Verification status on an account.
uid = "<uid>" #Required
email_template = "<email_template>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.account.invalidate_account_email_verification(uid, email_template, verification_url)
Reset phone ID verification (PUT)
This API Allows you to reset the phone no verification of an end user’s account.
uid = "<uid>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.account.reset_phone_id_verification_by_uid(uid, sms_template)
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.
upsert_email_model = {
"email" : [ {
"type" : "<type>" ,
"value" : "<value>"
} ]
} #Required
uid = "<uid>" #Required
fields = "<fields>" #Optional
result = loginradius.account.upsert_email(upsert_email_model, uid, fields)
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.
update_uid_model = {
"newUid" : "<newUid>"
} #Required
uid = "<uid>" #Required
result = loginradius.account.account_update_uid(update_uid_model, uid)
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
account_create_model = {
"email" : [ {
"type" : "<type>" ,
"value" : "<value>"
} ] ,
"firstName" : "<firstName>",
"lastName" : "<lastName>",
"password" : "<password>"
} #Required
fields = "<fields>" #Optional
result = loginradius.account.create_account(account_create_model, fields)
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.
email = "<email>" #Required
email_template = "<email_template>" #Optional
reset_password_url = "<reset_password_url>" #Optional
send_email = "True" #Optional
result = loginradius.account.get_forgot_password_token(email, email_template, reset_password_url, send_email)
Email Verification token (POST)
This API Returns an Email Verification token.
email = "<email>" #Required
result = loginradius.account.get_email_verification_token(email)
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.
email = "<email>" #Required
fields = "<fields>" #Optional
result = loginradius.account.get_account_profile_by_email(email, fields)
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.
phone = "<phone>" #Required
fields = "<fields>" #Optional
result = loginradius.account.get_account_profile_by_phone(phone, fields)
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.
uid = "<uid>" #Required
fields = "<fields>" #Optional
result = loginradius.account.get_account_profile_by_uid(uid, fields)
Account Password (GET)
This API use to retrive the hashed password of a specified account in Cloud Storage.
uid = "<uid>" #Required
result = loginradius.account.get_account_password_hash_by_uid(uid)
Access Token based on UID or User impersonation API (GET)
The API is used to get LoginRadius access token based on UID.
uid = "<uid>" #Required
result = loginradius.account.get_access_token_by_uid(uid)
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.
email = "<email>" #Required
fields = "<fields>" #Optional
result = loginradius.account.get_account_identities_by_email(email, fields)
Account Delete (DELETE)
This API deletes the Users account and allows them to re-register for a new account.
uid = "<uid>" #Required
result = loginradius.account.delete_account_by_uid(uid)
Account Remove Email (DELETE)
Use this API to Remove emails from a user Account
email = "<email>" #Required
uid = "<uid>" #Required
fields = "<fields>" #Optional
result = loginradius.account.remove_email(email, uid, fields)
Delete User Profiles By Email (DELETE)
This API is used to delete all user profiles associated with an Email.
email = "<email>" #Required
result = loginradius.account.account_delete_by_email(email)
PhoneAuthentication API
List of APIs in this Section:
- PUT : Phone Reset Password by OTP
- PUT : Phone Verification OTP
- PUT : Phone Verification OTP by Token
- PUT : Phone Number Update
- POST : Phone Login
- POST : Phone Forgot Password by OTP
- POST : Phone Resend Verification OTP
- POST : Phone Resend Verification OTP By Token
- POST : Phone User Registration by SMS
- GET : Phone Number Availability
- DELETE : Remove Phone ID by Access Token
Phone Reset Password by OTP (PUT)
This API is used to reset the password
reset_password_by_otp_model = {
"otp" : "<otp>",
"password" : "<password>",
"phone" : "<phone>"
} #Required
result = loginradius.phone_authentication.reset_password_by_phone_otp(reset_password_by_otp_model)
Phone Verification OTP (PUT)
This API is used to validate the verification code sent to verify a user's phone number
otp = "<otp>" #Required
phone = "<phone>" #Required
fields = "<fields>" #Optional
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.phone_verification_by_otp(otp, phone, fields, sms_template)
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.
access_token = "<access_token>" #Required
otp = "<otp>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.phone_verification_otp_by_access_token(access_token, otp, sms_template)
Phone Number Update (PUT)
This API is used to update the login Phone Number of users
access_token = "<access_token>" #Required
phone = "<phone>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.update_phone_number(access_token, phone, sms_template)
Phone Login (POST)
This API retrieves a copy of the user data based on the Phone
phone_authentication_model = {
"password" : "<password>",
"phone" : "<phone>"
} #Required
fields = "<fields>" #Optional
login_url = "<login_url>" #Optional
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.login_by_phone(phone_authentication_model, fields, login_url, sms_template)
Phone Forgot Password by OTP (POST)
This API is used to send the OTP to reset the account password.
phone = "<phone>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.forgot_password_by_phone_otp(phone, sms_template)
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
phone = "<phone>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.phone_resend_verification_otp(phone, sms_template)
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
access_token = "<access_token>" #Required
phone = "<phone>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.phone_authentication.phone_resend_verification_otp_by_token(access_token, phone, sms_template)
Phone User Registration by SMS (POST)
This API registers the new users into your Cloud Storage and triggers the phone verification process.
auth_user_registration_model = {
"firstName" : "<firstName>",
"lastName" : "<lastName>",
"password" : "<password>",
"phoneId" : "<phoneId>"
} #Required
sott = "<sott>" #Required
fields = "<fields>" #Optional
options = "<options>" #Optional
sms_template = "<sms_template>" #Optional
verification_url = "<verification_url>" #Optional
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.phone_authentication.user_registration_by_phone(auth_user_registration_model, sott, fields, options, sms_template, verification_url, welcome_email_template)
Phone Number Availability (GET)
This API is used to check the Phone Number exists or not on your site.
phone = "<phone>" #Required
result = loginradius.phone_authentication.check_phone_number_availability(phone)
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
access_token = "<access_token>" #Required
result = loginradius.phone_authentication.remove_phone_id_by_access_token(access_token)
MultiFactorAuthentication API
List of APIs in this Section:
- PUT : Update MFA by Access Token
- PUT : MFA Update Phone Number by Token
- PUT : MFA Validate Google Auth Code
- PUT : MFA Update Phone Number
- POST : MFA Email Login
- POST : MFA Phone Login
- GET : MFA Validate Access Token
- GET : MFA Resend Otp
- DELETE : MFA Reset Google Authenticator by Token
- DELETE : MFA Reset SMS Authenticator by Token
- DELETE : MFA Reset SMS Authenticator By UID
- DELETE : MFA Reset Google Authenticator By UID
Update MFA by Access Token (PUT)
This API is used to Enable Multi-factor authentication by access token on user login
access_token = "<access_token>" #Required
multi_factor_auth_model_by_google_authenticator_code = {
"googleAuthenticatorCode" : "<googleAuthenticatorCode>"
} #Required
fields = "<fields>" #Optional
sms_template = "<sms_template>" #Optional
result = loginradius.mfa.mfa_update_by_access_token(access_token, multi_factor_auth_model_by_google_authenticator_code, fields, sms_template)
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
access_token = "<access_token>" #Required
phone_no2_f_a = "<phone_no2_f_a>" #Required
sms_template2_f_a = "<sms_template2_f_a>" #Optional
result = loginradius.mfa.mfa_update_phone_number_by_token(access_token, phone_no2_f_a, sms_template2_f_a)
MFA Validate Google Auth Code (PUT)
This API is used to login via Multi-factor-authentication by passing the google authenticator code.
google_authenticator_code = "<google_authenticator_code>" #Required
second_factor_authentication_token = "<second_factor_authentication_token>" #Required
fields = "<fields>" #Optional
sms_template2_f_a = "<sms_template2_f_a>" #Optional
result = loginradius.mfa.mfa_validate_google_auth_code(google_authenticator_code, second_factor_authentication_token, fields, sms_template2_f_a)
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
phone_no2_f_a = "<phone_no2_f_a>" #Required
second_factor_authentication_token = "<second_factor_authentication_token>" #Required
sms_template2_f_a = "<sms_template2_f_a>" #Optional
result = loginradius.mfa.mfa_update_phone_number(phone_no2_f_a, second_factor_authentication_token, sms_template2_f_a)
MFA Email Login (POST)
This API can be used to login by emailid on a Multi-factor authentication enabled LoginRadius site.
email = "<email>" #Required
password = "<password>" #Required
email_template = "<email_template>" #Optional
fields = "<fields>" #Optional
login_url = "<login_url>" #Optional
sms_template = "<sms_template>" #Optional
sms_template2_f_a = "<sms_template2_f_a>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.mfa.mfa_login_by_email(email, password, email_template, fields, login_url, sms_template, sms_template2_f_a, verification_url)
MFA Phone Login (POST)
This API can be used to login by Phone on a Multi-factor authentication enabled LoginRadius site.
password = "<password>" #Required
phone = "<phone>" #Required
email_template = "<email_template>" #Optional
fields = "<fields>" #Optional
login_url = "<login_url>" #Optional
sms_template = "<sms_template>" #Optional
sms_template2_f_a = "<sms_template2_f_a>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.mfa.mfa_login_by_phone(password, phone, email_template, fields, login_url, sms_template, sms_template2_f_a, verification_url)
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.
access_token = "<access_token>" #Required
sms_template2_f_a = "<sms_template2_f_a>" #Optional
result = loginradius.mfa.mfa_configure_by_access_token(access_token, sms_template2_f_a)
MFA Resend Otp (GET)
This API is used to resending the verification OTP to the provided phone number
second_factor_authentication_token = "<second_factor_authentication_token>" #Required
sms_template2_f_a = "<sms_template2_f_a>" #Optional
result = loginradius.mfa.mfa_resend_otp(second_factor_authentication_token, sms_template2_f_a)
MFA Reset Google Authenticator by Token (DELETE)
This API Resets the Google Authenticator configurations on a given account via the access token
access_token = "<access_token>" #Required
googleauthenticator = "True" #Required
result = loginradius.mfa.mfa_reset_google_auth_by_token(access_token, googleauthenticator)
MFA Reset SMS Authenticator by Token (DELETE)
This API resets the SMS Authenticator configurations on a given account via the access token.
access_token = "<access_token>" #Required
otpauthenticator = "True" #Required
result = loginradius.mfa.mfa_reset_sms_auth_by_token(access_token, otpauthenticator)
MFA Reset SMS Authenticator By UID (DELETE)
This API resets the SMS Authenticator configurations on a given account via the UID.
otpauthenticator = "True" #Required
uid = "<uid>" #Required
result = loginradius.mfa.mfa_reset_sms_authenticator_by_uid(otpauthenticator, uid)
MFA Reset Google Authenticator By UID (DELETE)
This API resets the Google Authenticator configurations on a given account via the UID.
googleauthenticator = "True" #Required
uid = "<uid>" #Required
result = loginradius.mfa.mfa_reset_google_authenticator_by_uid(googleauthenticator, uid)
PasswordLessLogin API
List of APIs in this Section:
- PUT : Passwordless Login Phone Verification
- GET : Passwordless Login by Phone
- GET : Passwordless Login By Email
- GET : Passwordless Login Verification
Passwordless Login Phone Verification (PUT)
This API verifies an account by OTP and allows the customer to login.
password_less_login_otp_model = {
"otp" : "<otp>",
"phone" : "<phone>"
} #Required
fields = "<fields>" #Optional
sms_template = "<sms_template>" #Optional
result = loginradius.password_less_login.passwordless_login_phone_verification(password_less_login_otp_model, fields, sms_template)
Passwordless Login by Phone (GET)
API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID
phone = "<phone>" #Required
sms_template = "<sms_template>" #Optional
result = loginradius.password_less_login.passwordless_login_by_phone(phone, sms_template)
Passwordless Login By Email (GET)
This API is used to send a Passwordless Login verification link to the provided Email ID
email = "<email>" #Required
password_less_login_template = "<password_less_login_template>" #Optional
verification_url = "<verification_url>" #Optional
result = loginradius.password_less_login.passwordless_login_by_email(email, password_less_login_template, verification_url)
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
verification_token = "<verification_token>" #Required
fields = "<fields>" #Optional
welcome_email_template = "<welcome_email_template>" #Optional
result = loginradius.password_less_login.passwordless_login_verification(verification_token, fields, welcome_email_template)
Role API
List of APIs in this Section:
- PUT : Assign Roles by UID
- PUT : Upsert Context
- PUT : Add Permissions to Role
- POST : Roles Create
- GET : Roles by UID
- GET : Get Context with Roles and Permissions
- GET : Role Context profile
- GET : Roles List
- DELETE : Unassign Roles by UID
- DELETE : Delete Role Context
- DELETE : Delete Role from Context
- DELETE : Delete Additional Permission from Context
- DELETE : Account Delete Role
- DELETE : Remove Permissions
Assign Roles by UID (PUT)
This API is used to assign your desired roles to a given user.
account_roles_model = {
"roles" : [ "roles" ]
} #Required
uid = "<uid>" #Required
result = loginradius.role.assign_roles_by_uid(account_roles_model, uid)
Upsert Context (PUT)
This API creates a Context with a set of Roles
account_role_context_model = {
"roleContext" : [ {
"additionalPermissions" : ["<additionalPermissions>" ] ,
"context" : "<context>" ,
"expiration" : "<expiration>" ,
"roles" : ["<roles>" ]
} ]
} #Required
uid = "<uid>" #Required
result = loginradius.role.update_role_context_by_uid(account_role_context_model, uid)
Add Permissions to Role (PUT)
This API is used to add permissions to a given role.
permissions_model = {
"permissions" : [ "permissions" ]
} #Required
role = "<role>" #Required
result = loginradius.role.add_role_permissions(permissions_model, role)
Roles Create (POST)
This API creates a role with permissions.
roles_model = {
"roles" : [ {
"name" : "<name>" ,
"permissions" : {"Permission_name" : "True"}
} ]
} #Required
result = loginradius.role.create_roles(roles_model)
Roles by UID (GET)
API is used to retrieve all the assigned roles of a particular User.
uid = "<uid>" #Required
result = loginradius.role.get_roles_by_uid(uid)
Get Context with Roles and Permissions (GET)
This API Gets the contexts that have been configured and the associated roles and permissions.
uid = "<uid>" #Required
result = loginradius.role.get_role_context_by_uid(uid)
Role Context profile (GET)
The API is used to retrieve role context by the context name.
context_name = "<context_name>" #Required
result = loginradius.role.get_role_context_by_context_name(context_name)
Roles List (GET)
This API retrieves the complete list of created roles with permissions of your app.
result = loginradius.role.get_roles_list()
Unassign Roles by UID (DELETE)
This API is used to unassign roles from a user.
account_roles_model = {
"roles" : [ "roles" ]
} #Required
uid = "<uid>" #Required
result = loginradius.role.unassign_roles_by_uid(account_roles_model, uid)
Delete Role Context (DELETE)
This API Deletes the specified Role Context
context_name = "<context_name>" #Required
uid = "<uid>" #Required
result = loginradius.role.delete_role_context_by_uid(context_name, uid)
Delete Role from Context (DELETE)
This API Deletes the specified Role from a Context.
context_name = "<context_name>" #Required
role_context_remove_role_model = {
"roles" : [ "roles" ]
} #Required
uid = "<uid>" #Required
result = loginradius.role.delete_roles_from_role_context_by_uid(context_name, role_context_remove_role_model, uid)
Delete Additional Permission from Context (DELETE)
This API Deletes Additional Permissions from Context.
context_name = "<context_name>" #Required
role_context_additional_permission_remove_role_model = {
"additionalPermissions" : [ "additionalPermissions" ]
} #Required
uid = "<uid>" #Required
result = loginradius.role.delete_additional_permission_from_role_context_by_uid(context_name, role_context_additional_permission_remove_role_model, uid)
Account Delete Role (DELETE)
This API is used to delete the role.
role = "<role>" #Required
result = loginradius.role.delete_role(role)
Remove Permissions (DELETE)
API is used to remove permissions from a role.
permissions_model = {
"permissions" : [ "permissions" ]
} #Required
role = "<role>" #Required
result = loginradius.role.remove_role_permissions(permissions_model, role)
Sott API
List of APIs in this Section:
- GET : Generate SOTT
Generate SOTT (GET)
This API allows you to generate SOTT with a given expiration time.
time_difference = 0 #Optional
result = loginradius.sott.generate_sott(time_difference)
NativeSocial API
List of APIs in this Section:
- GET : Access Token via Facebook Token
- GET : Access Token via Twitter Token
- GET : Access Token via Google Token
- GET : Access Token using google JWT token for Native Mobile Login
- GET : Access Token via Linkedin Token
- GET : Access Token via Google AuthCode
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.
fb_access_token = "<fb_access_token>" #Required
result = loginradius.native_social.get_access_token_by_facebook_access_token(fb_access_token)
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.
tw_access_token = "<tw_access_token>" #Required
tw_token_secret = "<tw_token_secret>" #Required
result = loginradius.native_social.get_access_token_by_twitter_access_token(tw_access_token, tw_token_secret)
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.
google_access_token = "<google_access_token>" #Required
client_id = "<client_id>" #Optional
refresh_token = "<refresh_token>" #Optional
result = loginradius.native_social.get_access_token_by_google_access_token(google_access_token, client_id, refresh_token)
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.
id_token = "<id_token>" #Required
result = loginradius.native_social.get_access_token_by_google_j_w_t_access_token(id_token)
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.
ln_access_token = "<ln_access_token>" #Required
result = loginradius.native_social.get_access_token_by_linkedin_access_token(ln_access_token)
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.
google_authcode = "<google_authcode>" #Required
result = loginradius.native_social.get_access_token_by_google_auth_code(google_authcode)
WebHook API
List of APIs in this Section:
- POST : Webhook Subscribe
- GET : Webhook Subscribed URLs
- GET : Webhook Test
- DELETE : WebHook Unsubscribe
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.
web_hook_subscribe_model = {
"event" : "<event>",
"targetUrl" : "<targetUrl>"
} #Required
result = loginradius.web_hook.web_hook_subscribe(web_hook_subscribe_model)
Webhook Subscribed URLs (GET)
This API is used to fatch all the subscribed URLs, for particular event
event = "<event>" #Required
result = loginradius.web_hook.get_web_hook_subscribed_u_r_ls(event)
Webhook Test (GET)
API can be used to test a subscribed WebHook.
result = loginradius.web_hook.webhook_test()
WebHook Unsubscribe (DELETE)
API can be used to unsubscribe a WebHook configured on your LoginRadius site.
web_hook_subscribe_model = {
"event" : "<event>",
"targetUrl" : "<targetUrl>"
} #Required
result = loginradius.web_hook.web_hook_unsubscribe(web_hook_subscribe_model)