From d98cb4121b48b4380d01b411c8efc5d5ee6180cd Mon Sep 17 00:00:00 2001 From: ankit singh Date: Tue, 11 Aug 2020 11:34:32 +0530 Subject: [PATCH 1/2] Version 11.0.0 --- CHANGELOG.md | 18 ++ Demo/LoginRadius/api/account/account_api.py | 6 +- .../advanced/customregistrationdata_api.py | 2 +- .../advanced/multifactorauthentication_api.py | 12 +- .../api/advanced/reauthentication_api.py | 4 +- .../api/authentication/authentication_api.py | 80 ++++---- .../authentication/phoneauthentication_api.py | 2 +- .../authentication/pinauthentication_api.py | 2 +- .../api/social/nativesocial_api.py | 73 +++++++- Demo/LoginRadius/api/social/social_api.py | 7 +- README.md | 176 ++++++++++-------- demo/LoginRadius/__init__.py | 2 +- lib/LoginRadius/__init__.py | 2 +- lib/LoginRadius/api/account/account_api.py | 6 +- .../advanced/customregistrationdata_api.py | 2 +- .../advanced/multifactorauthentication_api.py | 12 +- .../api/advanced/reauthentication_api.py | 4 +- .../api/authentication/authentication_api.py | 80 ++++---- .../authentication/phoneauthentication_api.py | 2 +- .../authentication/pinauthentication_api.py | 2 +- .../api/social/nativesocial_api.py | 73 +++++++- lib/LoginRadius/api/social/social_api.py | 7 +- lib/README.md | 24 ++- lib/setup.py | 2 +- 24 files changed, 396 insertions(+), 204 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5ac0d..37608cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # LoginRadius Python SDK Change Log +# Version 11.0.0 +Release on **August 11,2020** +## Enhancements: + - Added a parameter isWeb in "RefreshAccessToken" API. + - Added a parameter SocialAppName in "getAccessTokenByFacebookAccessToken, getAccessTokenByTwitterAccessToken, + getAccessTokenByGoogleAccessToken, getAccessTokenByLinkedinAccessToken, getAccessTokenByAppleIdCode, + getAccessTokenByGoogleAuthCode" Native Social login APIs. + +## Added new multiple APIs for better user experience: + - Added linkSocialIdentites(POST) API. + - Added linkSocialIdentitiesByPing(POST) API. + - Added getAccessTokenByAppleIdCode API. + - Added getAccessTokenByWeChatCode API. + +## Removed APIs: + - linkSocialIdentity API(PUT) + - getSocialIdentity API(GET) + # Version 10.0.1 Release on **Oct 24,2019** ## Enhancements diff --git a/Demo/LoginRadius/api/account/account_api.py b/Demo/LoginRadius/api/account/account_api.py index 37051c7..5a2cbcf 100644 --- a/Demo/LoginRadius/api/account/account_api.py +++ b/Demo/LoginRadius/api/account/account_api.py @@ -477,10 +477,10 @@ def remove_email(self, email, uid, fields=''): return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) def refresh_access_token_by_refresh_token(self, refresh__token): - """This API is used to refresh an access_token via it's associated refresh_token. + """This API is used to refresh an access token via it's associated refresh token. Args: - refresh__token: LoginRadius refresh_token + refresh__token: LoginRadius refresh token Returns: Response containing Definition of Complete Token data @@ -502,7 +502,7 @@ def revoke_refresh_token(self, refresh__token): """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. Args: - refresh__token: LoginRadius refresh_token + refresh__token: LoginRadius refresh token Returns: Response containing Definition of Delete Request diff --git a/Demo/LoginRadius/api/advanced/customregistrationdata_api.py b/Demo/LoginRadius/api/advanced/customregistrationdata_api.py index 3a0dc22..c347116 100644 --- a/Demo/LoginRadius/api/advanced/customregistrationdata_api.py +++ b/Demo/LoginRadius/api/advanced/customregistrationdata_api.py @@ -102,7 +102,7 @@ def get_registration_data(self, type, limit=None, parent_id=None, return self._lr_object.execute("GET", resource_path, query_parameters, None) def add_registration_data(self, registration_data_create_model_list): - """This API allows you to fill data into a dropdown list which you have created for user Registeration. For more details on how to use this API please see our Custom Registration Data Overview + """This API allows you to fill data into a dropdown list which you have created for user Registration. For more details on how to use this API please see our Custom Registration Data Overview Args: registration_data_create_model_list: Model Class containing Definition of List of Registration Data diff --git a/Demo/LoginRadius/api/advanced/multifactorauthentication_api.py b/Demo/LoginRadius/api/advanced/multifactorauthentication_api.py index f630077..17c8a36 100644 --- a/Demo/LoginRadius/api/advanced/multifactorauthentication_api.py +++ b/Demo/LoginRadius/api/advanced/multifactorauthentication_api.py @@ -13,7 +13,7 @@ def __init__(self, lr_object): self._lr_object = lr_object def mfa_configure_by_access_token(self, access_token, sms_template2_f_a=None): - """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. + """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -126,7 +126,7 @@ def mfa_update_phone_number_by_token(self, access_token, phone_no2_f_a, sms_temp return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) def mfa_reset_google_auth_by_token(self, access_token, googleauthenticator): - """This API Resets the Google Authenticator configurations on a given account via the access_token + """This API Resets the Google Authenticator configurations on a given account via the access token Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -151,7 +151,7 @@ def mfa_reset_google_auth_by_token(self, access_token, googleauthenticator): return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) def mfa_reset_sms_auth_by_token(self, access_token, otpauthenticator): - """This API resets the SMS Authenticator configurations on a given account via the access_token. + """This API resets the SMS Authenticator configurations on a given account via the access token. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -176,7 +176,7 @@ def mfa_reset_sms_auth_by_token(self, access_token, otpauthenticator): return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) def mfa_backup_code_by_access_token(self, access_token): - """This API is used to get a set of backup codes via access_token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically + """This API is used to get a set of backup codes via access token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -197,7 +197,7 @@ def mfa_backup_code_by_access_token(self, access_token): return self._lr_object.execute("GET", resource_path, query_parameters, None) def mfa_reset_backup_code_by_access_token(self, access_token): - """API is used to reset the backup codes on a given account via the access_token. This API call will generate 10 new codes, each code can only be consumed once + """API is used to reset the backup codes on a given account via the access token. This API call will generate 10 new codes, each code can only be consumed once Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -428,7 +428,7 @@ def mfa_validate_google_auth_code(self, google_authenticator_code, second_factor return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) def mfa_validate_backup_code(self, multi_factor_auth_model_by_backup_code, second_factor_authentication_token, fields=''): - """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 + """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 Args: multi_factor_auth_model_by_backup_code: Model Class containing Definition of payload for MultiFactorAuth By BackupCode API diff --git a/Demo/LoginRadius/api/advanced/reauthentication_api.py b/Demo/LoginRadius/api/advanced/reauthentication_api.py index 24b8bda..3084fe4 100644 --- a/Demo/LoginRadius/api/advanced/reauthentication_api.py +++ b/Demo/LoginRadius/api/advanced/reauthentication_api.py @@ -13,7 +13,7 @@ def __init__(self, lr_object): self._lr_object = lr_object def mfa_re_authenticate(self, access_token, sms_template2_f_a=None): - """This API is used to trigger the Multi-Factor Autentication workflow for the provided access_token + """This API is used to trigger the Multi-Factor Autentication workflow for the provided access token Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -61,7 +61,7 @@ def mfa_re_authenticate_by_otp(self, access_token, reauth_by_otp_model): return self._lr_object.execute("PUT", resource_path, query_parameters, reauth_by_otp_model) def mfa_re_authenticate_by_backup_code(self, access_token, reauth_by_backup_code_model): - """This API is used to re-authenticate by set of backup codes via access_token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device + """This API is used to re-authenticate by set of backup codes via access token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. diff --git a/Demo/LoginRadius/api/authentication/authentication_api.py b/Demo/LoginRadius/api/authentication/authentication_api.py index 1757eb5..4d2249b 100644 --- a/Demo/LoginRadius/api/authentication/authentication_api.py +++ b/Demo/LoginRadius/api/authentication/authentication_api.py @@ -122,7 +122,7 @@ def auth_in_validate_access_token(self, access_token, prevent_refresh=False): Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - prevent_refresh: Boolean value that when set as true, in addition of the access_token being invalidated, it will no longer have the capability of being refreshed. + prevent_refresh: Boolean value that when set as true, in addition of the access token being invalidated, it will no longer have the capability of being refreshed. Returns: Response containing Definition of Complete Validation data @@ -163,7 +163,7 @@ def get_access_token_info(self, access_token): return self._lr_object.execute("GET", resource_path, query_parameters, None) def get_profile_by_access_token(self, access_token, fields=''): - """This API retrieves a copy of the user data based on the access_token. + """This API retrieves a copy of the user data based on the access token. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -212,7 +212,7 @@ def send_welcome_email(self, access_token, welcome_email_template=None): def update_profile_by_access_token(self, access_token, user_profile_update_model, email_template=None, fields='', null_support=None, sms_template=None, verification_url=None): - """This API is used to update the user's profile by passing the access_token. + """This API is used to update the user's profile by passing the access token. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -299,7 +299,7 @@ def delete_account_by_delete_token(self, deletetoken): return self._lr_object.execute("GET", resource_path, query_parameters, None) def unlock_account_by_token(self, access_token, unlock_profile_model): - """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. + """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -713,90 +713,94 @@ def change_password(self, access_token, new_password, old_password): resource_path = "identity/v2/auth/password/change" return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) - def link_social_identities(self, access_token, candidate_token): - """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. + def unlink_social_identities(self, access_token, provider, provider_id): + """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. Args: access_token: Access_Token - candidate_token: Access token of the account to be linked + provider: Name of the provider + provider_id: Unique ID of the linked account Returns: - Response containing Definition of Complete Validation data - 12.1 + Response containing Definition of Delete Request + 12.2 """ if(self._lr_object.is_null_or_whitespace(access_token)): raise Exception(self._lr_object.get_validation_message("access_token")) - if(self._lr_object.is_null_or_whitespace(candidate_token)): - raise Exception(self._lr_object.get_validation_message("candidate_token")) + if(self._lr_object.is_null_or_whitespace(provider)): + raise Exception(self._lr_object.get_validation_message("provider")) + + if(self._lr_object.is_null_or_whitespace(provider_id)): + raise Exception(self._lr_object.get_validation_message("provider_id")) query_parameters = {} query_parameters["access_token"] = access_token query_parameters["apiKey"] = self._lr_object.get_api_key() body_parameters = {} - body_parameters["candidateToken"] = candidate_token + body_parameters["provider"] = provider + body_parameters["providerId"] = provider_id resource_path = "identity/v2/auth/socialidentity" - return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) + return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) - def unlink_social_identities(self, access_token, provider, provider_id): - """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. + def link_social_identities(self, access_token, candidate_token): + """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. Args: - access_token: Access_Token - provider: Name of the provider - provider_id: Unique ID of the linked account + access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + candidate_token: Access token of the account to be linked Returns: - Response containing Definition of Delete Request - 12.2 + Response containing Definition of Complete Validation data + 12.4 """ if(self._lr_object.is_null_or_whitespace(access_token)): raise Exception(self._lr_object.get_validation_message("access_token")) - if(self._lr_object.is_null_or_whitespace(provider)): - raise Exception(self._lr_object.get_validation_message("provider")) - - if(self._lr_object.is_null_or_whitespace(provider_id)): - raise Exception(self._lr_object.get_validation_message("provider_id")) + if(self._lr_object.is_null_or_whitespace(candidate_token)): + raise Exception(self._lr_object.get_validation_message("candidate_token")) query_parameters = {} query_parameters["access_token"] = access_token query_parameters["apiKey"] = self._lr_object.get_api_key() body_parameters = {} - body_parameters["provider"] = provider - body_parameters["providerId"] = provider_id + body_parameters["candidateToken"] = candidate_token resource_path = "identity/v2/auth/socialidentity" - return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) + return self._lr_object.execute("POST", resource_path, query_parameters, body_parameters) - def get_social_identity(self, access_token, fields=''): - """This API is called just after account linking API and it prevents the raas profile of the second account from getting created. + def link_social_identities_by_ping(self, access_token, client_guid): + """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - fields: The fields parameter filters the API response so that the response only includes a specific set of fields + client_guid: Unique ID generated by client Returns: - Response containing Definition for Complete SocialUserProfile data - 12.3 + Response containing Definition of Complete Validation data + 12.5 """ if(self._lr_object.is_null_or_whitespace(access_token)): raise Exception(self._lr_object.get_validation_message("access_token")) + if(self._lr_object.is_null_or_whitespace(client_guid)): + raise Exception(self._lr_object.get_validation_message("client_guid")) + query_parameters = {} query_parameters["access_token"] = access_token query_parameters["apiKey"] = self._lr_object.get_api_key() - if(not self._lr_object.is_null_or_whitespace(fields)): - query_parameters["fields"] = fields + + body_parameters = {} + body_parameters["clientGuid"] = client_guid resource_path = "identity/v2/auth/socialidentity" - return self._lr_object.execute("GET", resource_path, query_parameters, None) + return self._lr_object.execute("POST", resource_path, query_parameters, body_parameters) def set_or_change_user_name(self, access_token, username): """This API is used to set or change UserName by access token. @@ -848,7 +852,7 @@ def check_user_name_availability(self, username): return self._lr_object.execute("GET", resource_path, query_parameters, None) def accept_privacy_policy(self, access_token, fields=''): - """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 + """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 Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -872,7 +876,7 @@ def accept_privacy_policy(self, access_token, fields=''): return self._lr_object.execute("GET", resource_path, query_parameters, None) def get_privacy_policy_history_by_access_token(self, access_token): - """This API will return all the accepted privacy policies for the user by providing the access_token of that user. + """This API will return all the accepted privacy policies for the user by providing the access token of that user. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. diff --git a/Demo/LoginRadius/api/authentication/phoneauthentication_api.py b/Demo/LoginRadius/api/authentication/phoneauthentication_api.py index b85706a..4852a93 100644 --- a/Demo/LoginRadius/api/authentication/phoneauthentication_api.py +++ b/Demo/LoginRadius/api/authentication/phoneauthentication_api.py @@ -260,7 +260,7 @@ def check_phone_number_availability(self, phone): return self._lr_object.execute("GET", resource_path, query_parameters, None) def remove_phone_id_by_access_token(self, access_token): - """This API is used to delete the Phone ID on a user's account via the access_token + """This API is used to delete the Phone ID on a user's account via the access token Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. diff --git a/Demo/LoginRadius/api/authentication/pinauthentication_api.py b/Demo/LoginRadius/api/authentication/pinauthentication_api.py index 5042fd5..9db77f4 100644 --- a/Demo/LoginRadius/api/authentication/pinauthentication_api.py +++ b/Demo/LoginRadius/api/authentication/pinauthentication_api.py @@ -13,7 +13,7 @@ def __init__(self, lr_object): self._lr_object = lr_object def pin_login(self, login_by_pin_model, session_token): - """This API is used to login a user by pin and session_token. + """This API is used to login a user by pin and session token. Args: login_by_pin_model: Model Class containing Definition of payload for LoginByPin API diff --git a/Demo/LoginRadius/api/social/nativesocial_api.py b/Demo/LoginRadius/api/social/nativesocial_api.py index 395d05a..7a05612 100644 --- a/Demo/LoginRadius/api/social/nativesocial_api.py +++ b/Demo/LoginRadius/api/social/nativesocial_api.py @@ -12,11 +12,12 @@ def __init__(self, lr_object): """ self._lr_object = lr_object - def get_access_token_by_facebook_access_token(self, fb__access__token): + def get_access_token_by_facebook_access_token(self, fb__access__token, social_app_name=None): """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. Args: fb__access__token: Facebook Access Token + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -29,16 +30,19 @@ def get_access_token_by_facebook_access_token(self, fb__access__token): query_parameters = {} query_parameters["fb_Access_Token"] = fb__access__token query_parameters["key"] = self._lr_object.get_api_key() + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/facebook" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_twitter_access_token(self, tw__access__token, tw__token__secret): + def get_access_token_by_twitter_access_token(self, tw__access__token, tw__token__secret, social_app_name=None): """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. Args: tw__access__token: Twitter Access Token tw__token__secret: Twitter Token Secret + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -55,17 +59,21 @@ def get_access_token_by_twitter_access_token(self, tw__access__token, tw__token_ query_parameters["key"] = self._lr_object.get_api_key() query_parameters["tw_Access_Token"] = tw__access__token query_parameters["tw_Token_Secret"] = tw__token__secret + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/twitter" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_google_access_token(self, google__access__token, client_id=None, refresh_token=None): + def get_access_token_by_google_access_token(self, google__access__token, client_id=None, refresh_token=None, + social_app_name=None): """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. Args: google__access__token: Google Access Token client_id: Google Client ID - refresh_token: LoginRadius refresh_token + refresh_token: LoginRadius refresh token + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -82,6 +90,8 @@ def get_access_token_by_google_access_token(self, google__access__token, client_ query_parameters["client_id"] = client_id if(not self._lr_object.is_null_or_whitespace(refresh_token)): query_parameters["refresh_token"] = refresh_token + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/google" return self._lr_object.execute("GET", resource_path, query_parameters, None) @@ -107,11 +117,12 @@ def get_access_token_by_google_j_w_t_access_token(self, id__token): resource_path = "api/v2/access_token/googlejwt" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_linkedin_access_token(self, ln__access__token): + def get_access_token_by_linkedin_access_token(self, ln__access__token, social_app_name=None): """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. Args: ln__access__token: Linkedin Access Token + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -124,6 +135,8 @@ def get_access_token_by_linkedin_access_token(self, ln__access__token): query_parameters = {} query_parameters["key"] = self._lr_object.get_api_key() query_parameters["ln_Access_Token"] = ln__access__token + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/linkedin" return self._lr_object.execute("GET", resource_path, query_parameters, None) @@ -149,6 +162,51 @@ def get_access_token_by_foursquare_access_token(self, fs__access__token): resource_path = "api/v2/access_token/foursquare" return self._lr_object.execute("GET", resource_path, query_parameters, None) + def get_access_token_by_apple_id_code(self, code, social_app_name=None): + """The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response. + + Args: + code: Apple Code + social_app_name: Name of Social provider APP + + Returns: + Response containing Definition of Complete Token data + 20.12 + """ + + if(self._lr_object.is_null_or_whitespace(code)): + raise Exception(self._lr_object.get_validation_message("code")) + + query_parameters = {} + query_parameters["code"] = code + query_parameters["key"] = self._lr_object.get_api_key() + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name + + resource_path = "api/v2/access_token/apple" + return self._lr_object.execute("GET", resource_path, query_parameters, None) + + def get_access_token_by_we_chat_code(self, code): + """This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. + + Args: + code: WeChat Code + + Returns: + Response containing Definition of Complete Token data + 20.13 + """ + + if(self._lr_object.is_null_or_whitespace(code)): + raise Exception(self._lr_object.get_validation_message("code")) + + query_parameters = {} + query_parameters["code"] = code + query_parameters["key"] = self._lr_object.get_api_key() + + resource_path = "api/v2/access_token/wechat" + return self._lr_object.execute("GET", resource_path, query_parameters, None) + def get_access_token_by_vkontakte_access_token(self, vk_access_token): """The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response. @@ -170,11 +228,12 @@ def get_access_token_by_vkontakte_access_token(self, vk_access_token): resource_path = "api/v2/access_token/vkontakte" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_google_auth_code(self, google_authcode): + def get_access_token_by_google_auth_code(self, google_authcode, social_app_name=None): """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. Args: google_authcode: Google AuthCode + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -187,6 +246,8 @@ def get_access_token_by_google_auth_code(self, google_authcode): query_parameters = {} query_parameters["apiKey"] = self._lr_object.get_api_key() query_parameters["google_authcode"] = google_authcode + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/google" return self._lr_object.execute("GET", resource_path, query_parameters, None) diff --git a/Demo/LoginRadius/api/social/social_api.py b/Demo/LoginRadius/api/social/social_api.py index 9b6550c..ea8a9c8 100644 --- a/Demo/LoginRadius/api/social/social_api.py +++ b/Demo/LoginRadius/api/social/social_api.py @@ -33,12 +33,13 @@ def exchange_access_token(self, token): resource_path = "api/v2/access_token" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def refresh_access_token(self, access_token, expires_in=0): + def refresh_access_token(self, access_token, expires_in=0, is_web=False): """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - expires_in: Allows you to specify a desired expiration time in minutes for the newly issued access_token. + expires_in: Allows you to specify a desired expiration time in minutes for the newly issued access token. + is_web: Is web or not. Returns: Response containing Definition of Complete Token data @@ -53,6 +54,8 @@ def refresh_access_token(self, access_token, expires_in=0): query_parameters["secret"] = self._lr_object.get_api_secret() if(expires_in is not None): query_parameters["expiresIn"] = expires_in + if(is_web is not None): + query_parameters["isWeb"] = is_web resource_path = "api/v2/access_token/refresh" return self._lr_object.execute("GET", resource_path, query_parameters, None) diff --git a/README.md b/README.md index 995d9a4..545ef13 100755 --- a/README.md +++ b/README.md @@ -29,13 +29,13 @@ You will need at least Python - 2.7 or greater. LoginRadius module utilizes the Using pip ``` - pip install loginradius-v2==10.0.1 + pip install loginradius-v2==11.0.0 ``` or with easy_install ``` - easy_install loginradius-v2==10.0.1 + easy_install loginradius-v2==11.0.0 ``` ### Install From Source @@ -104,13 +104,14 @@ List of APIs in this Section:
* 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 Link Social Identities](#LinkSocialIdentities-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-)
@@ -125,7 +126,6 @@ List of APIs in this Section:
* GET : [Auth Delete Account](#DeleteAccountByDeleteToken-get-)
* GET : [Auth Check Email Availability](#CheckEmailAvailability-get-)
* GET : [Auth Verify Email](#VerifyEmail-get-)
-* GET : [Auth Social Identity](#GetSocialIdentity-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-)
@@ -137,7 +137,7 @@ List of APIs in this Section:
Auth Update Profile by Token (PUT)
- This API is used to update the user's profile by passing the access_token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-update-profile-by-token/) + 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/) ``` @@ -159,7 +159,7 @@ result = loginradius.authentication.update_profile_by_access_token(access_token,
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/) + 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/) ``` @@ -309,20 +309,6 @@ result = loginradius.authentication.change_password(access_token, new_password, -
Auth Link Social Identities (PUT)
- 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](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-link-social-identities) - - ``` - -access_token = "" #Required -candidate_token = "" #Required - -result = loginradius.authentication.link_social_identities(access_token, candidate_token) - ``` - - - -
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/) @@ -424,6 +410,34 @@ result = loginradius.authentication.forgot_password(email, reset_password_url, e +
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) + + ``` + +access_token = "" #Required +candidate_token = "" #Required + +result = loginradius.authentication.link_social_identities(access_token, candidate_token) + ``` + + + + +
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) + + ``` + +access_token = "" #Required +client_guid = "" #Required + +result = loginradius.authentication.link_social_identities_by_ping(access_token, client_guid) + ``` + + + +
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) @@ -572,7 +586,7 @@ 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. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-read-profiles-by-token/) + 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/) ``` @@ -641,20 +655,6 @@ result = loginradius.authentication.verify_email(verification_token, fields, url -
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. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-social-identity) - - ``` - -access_token = "" #Required -fields = "" #Optional - -result = loginradius.authentication.get_social_identity(access_token, fields) - ``` - - - -
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/) @@ -669,7 +669,7 @@ result = loginradius.authentication.check_user_name_availability(username)
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) + 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) ``` @@ -683,7 +683,7 @@ result = loginradius.authentication.accept_privacy_policy(access_token, fields)
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/) + 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/) ``` @@ -752,7 +752,6 @@ List of APIs in this Section:
* 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-)
@@ -774,7 +773,7 @@ List of APIs in this Section:
Account Update (PUT)
- This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section Here for more capabilities. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-update) + 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) ``` @@ -870,22 +869,6 @@ 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. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-update/) - - ``` - -update_uid_model = { -"newUid" : "" -} #Required -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 [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/account-create) @@ -1033,7 +1016,7 @@ result = loginradius.account.get_access_token_by_uid(uid)
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) + 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) ``` @@ -1234,9 +1217,10 @@ result = loginradius.social.exchange_access_token(token) ``` access_token = "" #Required -expires_in = 0 #Optional +expires_in = 0 #Optional +is_web = "True" #Optional -result = loginradius.social.refresh_access_token(access_token, expires_in) +result = loginradius.social.refresh_access_token(access_token, expires_in, is_web) ``` @@ -1996,7 +1980,7 @@ 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 [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/remove-phone-id-by-access-token) + 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) ``` @@ -2124,7 +2108,7 @@ result = loginradius.mfa.mfa_validate_google_auth_code(google_authenticator_code
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/) + 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/) ``` @@ -2216,7 +2200,7 @@ result = loginradius.mfa.mfa_login_by_phone(password, phone, email_template, fie
MFA Validate Access Token (GET)
- This API is used to configure the Multi-factor authentication after login by using the access_token when MFA is set as optional on the LoginRadius site. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/mfa-validate-access-token/) + This API is used to configure the Multi-factor authentication after login by using the access token when MFA is set as optional on the LoginRadius site. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/mfa-validate-access-token/) ``` @@ -2230,7 +2214,7 @@ result = loginradius.mfa.mfa_configure_by_access_token(access_token, sms_templat
MFA Backup Code by Access Token (GET)
- This API is used to get a set of backup codes via access_token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/backup-codes/mfa-backup-code-by-access-token/) + This API is used to get a set of backup codes via access token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/backup-codes/mfa-backup-code-by-access-token/) ``` @@ -2243,7 +2227,7 @@ result = loginradius.mfa.mfa_backup_code_by_access_token(access_token)
Reset Backup Code by Access Token (GET)
- API is used to reset the backup codes on a given account via the access_token. This API call will generate 10 new codes, each code can only be consumed once [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/backup-codes/mfa-reset-backup-code-by-access-token/) + API is used to reset the backup codes on a given account via the access token. This API call will generate 10 new codes, each code can only be consumed once [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/backup-codes/mfa-reset-backup-code-by-access-token/) ``` @@ -2296,7 +2280,7 @@ result = loginradius.mfa.mfa_reset_backup_code_by_uid(uid)
MFA Reset Google Authenticator by Token (DELETE)
- This API Resets the Google Authenticator configurations on a given account via the access_token [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/google-authenticator/mfa-reset-google-authenticator-by-token/) + This API Resets the Google Authenticator configurations on a given account via the access token [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/google-authenticator/mfa-reset-google-authenticator-by-token/) ``` @@ -2310,7 +2294,7 @@ result = loginradius.mfa.mfa_reset_google_auth_by_token(access_token, googleauth
MFA Reset SMS Authenticator by Token (DELETE)
- This API resets the SMS Authenticator configurations on a given account via the access_token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/sms-authenticator/mfa-reset-sms-authenticator-by-token/) + This API resets the SMS Authenticator configurations on a given account via the access token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/sms-authenticator/mfa-reset-sms-authenticator-by-token/) ``` @@ -2512,7 +2496,7 @@ result = loginradius.pin_authentication.reset_pin_by_username_and_otp(reset_pin_
PIN Login (POST)
- This API is used to login a user by pin and session_token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/pin-authentication/login-by-pin/) + This API is used to login a user by pin and session token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/pin-authentication/login-by-pin/) ``` @@ -2643,7 +2627,7 @@ result = loginradius.re_authentication.mfa_re_authenticate_by_otp(access_token,
Validate MFA by Backup Code (PUT)
- This API is used to re-authenticate by set of backup codes via access_token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/mfa/re-auth-by-backup-code/) + This API is used to re-authenticate by set of backup codes via access token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/mfa/re-auth-by-backup-code/) ``` @@ -2757,7 +2741,7 @@ result = loginradius.re_authentication.verify_multi_factor_pin_reauthentication(
Multi Factor Re-Authenticate (GET)
- This API is used to trigger the Multi-Factor Autentication workflow for the provided access_token [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/re-authentication/re-auth-trigger/) + This API is used to trigger the Multi-Factor Autentication workflow for the provided access token [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/re-authentication/re-auth-trigger/) ``` @@ -3480,7 +3464,7 @@ result = loginradius.custom_registration_data.validate_registration_data_code(co
Add Registration Data (POST)
- This API allows you to fill data into a dropdown list which you have created for user Registeration. For more details on how to use this API please see our Custom Registration Data Overview [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-registration-data/add-registration-data) + This API allows you to fill data into a dropdown list which you have created for user Registration. For more details on how to use this API please see our Custom Registration Data Overview [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-registration-data/add-registration-data) ``` @@ -3710,6 +3694,8 @@ List of APIs in this Section:
* GET : [Access Token using google JWT token for Native Mobile Login](#GetAccessTokenByGoogleJWTAccessToken-get-)
* GET : [Access Token via Linkedin Token](#GetAccessTokenByLinkedinAccessToken-get-)
* GET : [Get Access Token By Foursquare Access Token](#GetAccessTokenByFoursquareAccessToken-get-)
+* GET : [Access Token via Apple Id Code](#GetAccessTokenByAppleIdCode-get-)
+* GET : [Access Token via WeChat Code](#GetAccessTokenByWeChatCode-get-)
* GET : [Access Token via Vkontakte Token](#GetAccessTokenByVkontakteAccessToken-get-)
* GET : [Access Token via Google AuthCode](#GetAccessTokenByGoogleAuthCode-get-)
@@ -3721,9 +3707,10 @@ List of APIs in this Section:
``` -fb_access_token = "" #Required +fb_access_token = "" #Required +social_app_name = "" #Optional -result = loginradius.native_social.get_access_token_by_facebook_access_token(fb_access_token) +result = loginradius.native_social.get_access_token_by_facebook_access_token(fb_access_token, social_app_name) ``` @@ -3735,9 +3722,10 @@ result = loginradius.native_social.get_access_token_by_facebook_access_token(fb_ ``` tw_access_token = "" #Required -tw_token_secret = "" #Required +tw_token_secret = "" #Required +social_app_name = "" #Optional -result = loginradius.native_social.get_access_token_by_twitter_access_token(tw_access_token, tw_token_secret) +result = loginradius.native_social.get_access_token_by_twitter_access_token(tw_access_token, tw_token_secret, social_app_name) ``` @@ -3750,9 +3738,10 @@ result = loginradius.native_social.get_access_token_by_twitter_access_token(tw_a google_access_token = "" #Required client_id = "" #Optional -refresh_token = "" #Optional +refresh_token = "" #Optional +social_app_name = "" #Optional -result = loginradius.native_social.get_access_token_by_google_access_token(google_access_token, client_id, refresh_token) +result = loginradius.native_social.get_access_token_by_google_access_token(google_access_token, client_id, refresh_token, social_app_name) ``` @@ -3776,9 +3765,10 @@ result = loginradius.native_social.get_access_token_by_google_j_w_t_access_token ``` -ln_access_token = "" #Required +ln_access_token = "" #Required +social_app_name = "" #Optional -result = loginradius.native_social.get_access_token_by_linkedin_access_token(ln_access_token) +result = loginradius.native_social.get_access_token_by_linkedin_access_token(ln_access_token, social_app_name) ``` @@ -3797,6 +3787,33 @@ result = loginradius.native_social.get_access_token_by_foursquare_access_token(f +
Access Token via Apple Id Code (GET)
+ The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-apple-id-code) + + ``` + +code = "" #Required +social_app_name = "" #Optional + +result = loginradius.native_social.get_access_token_by_apple_id_code(code, social_app_name) + ``` + + + + +
Access Token via WeChat Code (GET)
+ This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-wechat-code) + + ``` + +code = "" #Required + +result = loginradius.native_social.get_access_token_by_we_chat_code(code) + ``` + + + +
Access Token via Vkontakte Token (GET)
The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-vkontakte-token) @@ -3815,9 +3832,10 @@ result = loginradius.native_social.get_access_token_by_vkontakte_access_token(vk ``` -google_authcode = "" #Required +google_authcode = "" #Required +social_app_name = "" #Optional -result = loginradius.native_social.get_access_token_by_google_auth_code(google_authcode) +result = loginradius.native_social.get_access_token_by_google_auth_code(google_authcode, social_app_name) ``` diff --git a/demo/LoginRadius/__init__.py b/demo/LoginRadius/__init__.py index fc43142..c422d23 100644 --- a/demo/LoginRadius/__init__.py +++ b/demo/LoginRadius/__init__.py @@ -20,7 +20,7 @@ __copyright__ = "Copyright 2019, LoginRadius" __email__ = "developers@loginradius.com" __status__ = "Production" -__version__ = "10.0.1" +__version__ = "11.0.0" import json import sys diff --git a/lib/LoginRadius/__init__.py b/lib/LoginRadius/__init__.py index fc43142..c422d23 100755 --- a/lib/LoginRadius/__init__.py +++ b/lib/LoginRadius/__init__.py @@ -20,7 +20,7 @@ __copyright__ = "Copyright 2019, LoginRadius" __email__ = "developers@loginradius.com" __status__ = "Production" -__version__ = "10.0.1" +__version__ = "11.0.0" import json import sys diff --git a/lib/LoginRadius/api/account/account_api.py b/lib/LoginRadius/api/account/account_api.py index 37051c7..5a2cbcf 100644 --- a/lib/LoginRadius/api/account/account_api.py +++ b/lib/LoginRadius/api/account/account_api.py @@ -477,10 +477,10 @@ def remove_email(self, email, uid, fields=''): return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) def refresh_access_token_by_refresh_token(self, refresh__token): - """This API is used to refresh an access_token via it's associated refresh_token. + """This API is used to refresh an access token via it's associated refresh token. Args: - refresh__token: LoginRadius refresh_token + refresh__token: LoginRadius refresh token Returns: Response containing Definition of Complete Token data @@ -502,7 +502,7 @@ def revoke_refresh_token(self, refresh__token): """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. Args: - refresh__token: LoginRadius refresh_token + refresh__token: LoginRadius refresh token Returns: Response containing Definition of Delete Request diff --git a/lib/LoginRadius/api/advanced/customregistrationdata_api.py b/lib/LoginRadius/api/advanced/customregistrationdata_api.py index 3a0dc22..c347116 100644 --- a/lib/LoginRadius/api/advanced/customregistrationdata_api.py +++ b/lib/LoginRadius/api/advanced/customregistrationdata_api.py @@ -102,7 +102,7 @@ def get_registration_data(self, type, limit=None, parent_id=None, return self._lr_object.execute("GET", resource_path, query_parameters, None) def add_registration_data(self, registration_data_create_model_list): - """This API allows you to fill data into a dropdown list which you have created for user Registeration. For more details on how to use this API please see our Custom Registration Data Overview + """This API allows you to fill data into a dropdown list which you have created for user Registration. For more details on how to use this API please see our Custom Registration Data Overview Args: registration_data_create_model_list: Model Class containing Definition of List of Registration Data diff --git a/lib/LoginRadius/api/advanced/multifactorauthentication_api.py b/lib/LoginRadius/api/advanced/multifactorauthentication_api.py index f630077..17c8a36 100644 --- a/lib/LoginRadius/api/advanced/multifactorauthentication_api.py +++ b/lib/LoginRadius/api/advanced/multifactorauthentication_api.py @@ -13,7 +13,7 @@ def __init__(self, lr_object): self._lr_object = lr_object def mfa_configure_by_access_token(self, access_token, sms_template2_f_a=None): - """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. + """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -126,7 +126,7 @@ def mfa_update_phone_number_by_token(self, access_token, phone_no2_f_a, sms_temp return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) def mfa_reset_google_auth_by_token(self, access_token, googleauthenticator): - """This API Resets the Google Authenticator configurations on a given account via the access_token + """This API Resets the Google Authenticator configurations on a given account via the access token Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -151,7 +151,7 @@ def mfa_reset_google_auth_by_token(self, access_token, googleauthenticator): return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) def mfa_reset_sms_auth_by_token(self, access_token, otpauthenticator): - """This API resets the SMS Authenticator configurations on a given account via the access_token. + """This API resets the SMS Authenticator configurations on a given account via the access token. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -176,7 +176,7 @@ def mfa_reset_sms_auth_by_token(self, access_token, otpauthenticator): return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) def mfa_backup_code_by_access_token(self, access_token): - """This API is used to get a set of backup codes via access_token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically + """This API is used to get a set of backup codes via access token to allow the user login on a site that has Multi-factor Authentication enabled in the event that the user does not have a secondary factor available. We generate 10 codes, each code can only be consumed once. If any user attempts to go over the number of invalid login attempts configured in the Dashboard then the account gets blocked automatically Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -197,7 +197,7 @@ def mfa_backup_code_by_access_token(self, access_token): return self._lr_object.execute("GET", resource_path, query_parameters, None) def mfa_reset_backup_code_by_access_token(self, access_token): - """API is used to reset the backup codes on a given account via the access_token. This API call will generate 10 new codes, each code can only be consumed once + """API is used to reset the backup codes on a given account via the access token. This API call will generate 10 new codes, each code can only be consumed once Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -428,7 +428,7 @@ def mfa_validate_google_auth_code(self, google_authenticator_code, second_factor return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) def mfa_validate_backup_code(self, multi_factor_auth_model_by_backup_code, second_factor_authentication_token, fields=''): - """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 + """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 Args: multi_factor_auth_model_by_backup_code: Model Class containing Definition of payload for MultiFactorAuth By BackupCode API diff --git a/lib/LoginRadius/api/advanced/reauthentication_api.py b/lib/LoginRadius/api/advanced/reauthentication_api.py index 24b8bda..3084fe4 100644 --- a/lib/LoginRadius/api/advanced/reauthentication_api.py +++ b/lib/LoginRadius/api/advanced/reauthentication_api.py @@ -13,7 +13,7 @@ def __init__(self, lr_object): self._lr_object = lr_object def mfa_re_authenticate(self, access_token, sms_template2_f_a=None): - """This API is used to trigger the Multi-Factor Autentication workflow for the provided access_token + """This API is used to trigger the Multi-Factor Autentication workflow for the provided access token Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -61,7 +61,7 @@ def mfa_re_authenticate_by_otp(self, access_token, reauth_by_otp_model): return self._lr_object.execute("PUT", resource_path, query_parameters, reauth_by_otp_model) def mfa_re_authenticate_by_backup_code(self, access_token, reauth_by_backup_code_model): - """This API is used to re-authenticate by set of backup codes via access_token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device + """This API is used to re-authenticate by set of backup codes via access token on the site that has Multi-factor authentication enabled in re-authentication for the user that does not have the device Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. diff --git a/lib/LoginRadius/api/authentication/authentication_api.py b/lib/LoginRadius/api/authentication/authentication_api.py index 1757eb5..4d2249b 100644 --- a/lib/LoginRadius/api/authentication/authentication_api.py +++ b/lib/LoginRadius/api/authentication/authentication_api.py @@ -122,7 +122,7 @@ def auth_in_validate_access_token(self, access_token, prevent_refresh=False): Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - prevent_refresh: Boolean value that when set as true, in addition of the access_token being invalidated, it will no longer have the capability of being refreshed. + prevent_refresh: Boolean value that when set as true, in addition of the access token being invalidated, it will no longer have the capability of being refreshed. Returns: Response containing Definition of Complete Validation data @@ -163,7 +163,7 @@ def get_access_token_info(self, access_token): return self._lr_object.execute("GET", resource_path, query_parameters, None) def get_profile_by_access_token(self, access_token, fields=''): - """This API retrieves a copy of the user data based on the access_token. + """This API retrieves a copy of the user data based on the access token. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -212,7 +212,7 @@ def send_welcome_email(self, access_token, welcome_email_template=None): def update_profile_by_access_token(self, access_token, user_profile_update_model, email_template=None, fields='', null_support=None, sms_template=None, verification_url=None): - """This API is used to update the user's profile by passing the access_token. + """This API is used to update the user's profile by passing the access token. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -299,7 +299,7 @@ def delete_account_by_delete_token(self, deletetoken): return self._lr_object.execute("GET", resource_path, query_parameters, None) def unlock_account_by_token(self, access_token, unlock_profile_model): - """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. + """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -713,90 +713,94 @@ def change_password(self, access_token, new_password, old_password): resource_path = "identity/v2/auth/password/change" return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) - def link_social_identities(self, access_token, candidate_token): - """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. + def unlink_social_identities(self, access_token, provider, provider_id): + """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. Args: access_token: Access_Token - candidate_token: Access token of the account to be linked + provider: Name of the provider + provider_id: Unique ID of the linked account Returns: - Response containing Definition of Complete Validation data - 12.1 + Response containing Definition of Delete Request + 12.2 """ if(self._lr_object.is_null_or_whitespace(access_token)): raise Exception(self._lr_object.get_validation_message("access_token")) - if(self._lr_object.is_null_or_whitespace(candidate_token)): - raise Exception(self._lr_object.get_validation_message("candidate_token")) + if(self._lr_object.is_null_or_whitespace(provider)): + raise Exception(self._lr_object.get_validation_message("provider")) + + if(self._lr_object.is_null_or_whitespace(provider_id)): + raise Exception(self._lr_object.get_validation_message("provider_id")) query_parameters = {} query_parameters["access_token"] = access_token query_parameters["apiKey"] = self._lr_object.get_api_key() body_parameters = {} - body_parameters["candidateToken"] = candidate_token + body_parameters["provider"] = provider + body_parameters["providerId"] = provider_id resource_path = "identity/v2/auth/socialidentity" - return self._lr_object.execute("PUT", resource_path, query_parameters, body_parameters) + return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) - def unlink_social_identities(self, access_token, provider, provider_id): - """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. + def link_social_identities(self, access_token, candidate_token): + """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. Args: - access_token: Access_Token - provider: Name of the provider - provider_id: Unique ID of the linked account + access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + candidate_token: Access token of the account to be linked Returns: - Response containing Definition of Delete Request - 12.2 + Response containing Definition of Complete Validation data + 12.4 """ if(self._lr_object.is_null_or_whitespace(access_token)): raise Exception(self._lr_object.get_validation_message("access_token")) - if(self._lr_object.is_null_or_whitespace(provider)): - raise Exception(self._lr_object.get_validation_message("provider")) - - if(self._lr_object.is_null_or_whitespace(provider_id)): - raise Exception(self._lr_object.get_validation_message("provider_id")) + if(self._lr_object.is_null_or_whitespace(candidate_token)): + raise Exception(self._lr_object.get_validation_message("candidate_token")) query_parameters = {} query_parameters["access_token"] = access_token query_parameters["apiKey"] = self._lr_object.get_api_key() body_parameters = {} - body_parameters["provider"] = provider - body_parameters["providerId"] = provider_id + body_parameters["candidateToken"] = candidate_token resource_path = "identity/v2/auth/socialidentity" - return self._lr_object.execute("DELETE", resource_path, query_parameters, body_parameters) + return self._lr_object.execute("POST", resource_path, query_parameters, body_parameters) - def get_social_identity(self, access_token, fields=''): - """This API is called just after account linking API and it prevents the raas profile of the second account from getting created. + def link_social_identities_by_ping(self, access_token, client_guid): + """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - fields: The fields parameter filters the API response so that the response only includes a specific set of fields + client_guid: Unique ID generated by client Returns: - Response containing Definition for Complete SocialUserProfile data - 12.3 + Response containing Definition of Complete Validation data + 12.5 """ if(self._lr_object.is_null_or_whitespace(access_token)): raise Exception(self._lr_object.get_validation_message("access_token")) + if(self._lr_object.is_null_or_whitespace(client_guid)): + raise Exception(self._lr_object.get_validation_message("client_guid")) + query_parameters = {} query_parameters["access_token"] = access_token query_parameters["apiKey"] = self._lr_object.get_api_key() - if(not self._lr_object.is_null_or_whitespace(fields)): - query_parameters["fields"] = fields + + body_parameters = {} + body_parameters["clientGuid"] = client_guid resource_path = "identity/v2/auth/socialidentity" - return self._lr_object.execute("GET", resource_path, query_parameters, None) + return self._lr_object.execute("POST", resource_path, query_parameters, body_parameters) def set_or_change_user_name(self, access_token, username): """This API is used to set or change UserName by access token. @@ -848,7 +852,7 @@ def check_user_name_availability(self, username): return self._lr_object.execute("GET", resource_path, query_parameters, None) def accept_privacy_policy(self, access_token, fields=''): - """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 + """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 Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -872,7 +876,7 @@ def accept_privacy_policy(self, access_token, fields=''): return self._lr_object.execute("GET", resource_path, query_parameters, None) def get_privacy_policy_history_by_access_token(self, access_token): - """This API will return all the accepted privacy policies for the user by providing the access_token of that user. + """This API will return all the accepted privacy policies for the user by providing the access token of that user. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. diff --git a/lib/LoginRadius/api/authentication/phoneauthentication_api.py b/lib/LoginRadius/api/authentication/phoneauthentication_api.py index b85706a..4852a93 100644 --- a/lib/LoginRadius/api/authentication/phoneauthentication_api.py +++ b/lib/LoginRadius/api/authentication/phoneauthentication_api.py @@ -260,7 +260,7 @@ def check_phone_number_availability(self, phone): return self._lr_object.execute("GET", resource_path, query_parameters, None) def remove_phone_id_by_access_token(self, access_token): - """This API is used to delete the Phone ID on a user's account via the access_token + """This API is used to delete the Phone ID on a user's account via the access token Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. diff --git a/lib/LoginRadius/api/authentication/pinauthentication_api.py b/lib/LoginRadius/api/authentication/pinauthentication_api.py index 5042fd5..9db77f4 100644 --- a/lib/LoginRadius/api/authentication/pinauthentication_api.py +++ b/lib/LoginRadius/api/authentication/pinauthentication_api.py @@ -13,7 +13,7 @@ def __init__(self, lr_object): self._lr_object = lr_object def pin_login(self, login_by_pin_model, session_token): - """This API is used to login a user by pin and session_token. + """This API is used to login a user by pin and session token. Args: login_by_pin_model: Model Class containing Definition of payload for LoginByPin API diff --git a/lib/LoginRadius/api/social/nativesocial_api.py b/lib/LoginRadius/api/social/nativesocial_api.py index 395d05a..7a05612 100644 --- a/lib/LoginRadius/api/social/nativesocial_api.py +++ b/lib/LoginRadius/api/social/nativesocial_api.py @@ -12,11 +12,12 @@ def __init__(self, lr_object): """ self._lr_object = lr_object - def get_access_token_by_facebook_access_token(self, fb__access__token): + def get_access_token_by_facebook_access_token(self, fb__access__token, social_app_name=None): """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. Args: fb__access__token: Facebook Access Token + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -29,16 +30,19 @@ def get_access_token_by_facebook_access_token(self, fb__access__token): query_parameters = {} query_parameters["fb_Access_Token"] = fb__access__token query_parameters["key"] = self._lr_object.get_api_key() + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/facebook" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_twitter_access_token(self, tw__access__token, tw__token__secret): + def get_access_token_by_twitter_access_token(self, tw__access__token, tw__token__secret, social_app_name=None): """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. Args: tw__access__token: Twitter Access Token tw__token__secret: Twitter Token Secret + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -55,17 +59,21 @@ def get_access_token_by_twitter_access_token(self, tw__access__token, tw__token_ query_parameters["key"] = self._lr_object.get_api_key() query_parameters["tw_Access_Token"] = tw__access__token query_parameters["tw_Token_Secret"] = tw__token__secret + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/twitter" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_google_access_token(self, google__access__token, client_id=None, refresh_token=None): + def get_access_token_by_google_access_token(self, google__access__token, client_id=None, refresh_token=None, + social_app_name=None): """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. Args: google__access__token: Google Access Token client_id: Google Client ID - refresh_token: LoginRadius refresh_token + refresh_token: LoginRadius refresh token + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -82,6 +90,8 @@ def get_access_token_by_google_access_token(self, google__access__token, client_ query_parameters["client_id"] = client_id if(not self._lr_object.is_null_or_whitespace(refresh_token)): query_parameters["refresh_token"] = refresh_token + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/google" return self._lr_object.execute("GET", resource_path, query_parameters, None) @@ -107,11 +117,12 @@ def get_access_token_by_google_j_w_t_access_token(self, id__token): resource_path = "api/v2/access_token/googlejwt" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_linkedin_access_token(self, ln__access__token): + def get_access_token_by_linkedin_access_token(self, ln__access__token, social_app_name=None): """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. Args: ln__access__token: Linkedin Access Token + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -124,6 +135,8 @@ def get_access_token_by_linkedin_access_token(self, ln__access__token): query_parameters = {} query_parameters["key"] = self._lr_object.get_api_key() query_parameters["ln_Access_Token"] = ln__access__token + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/linkedin" return self._lr_object.execute("GET", resource_path, query_parameters, None) @@ -149,6 +162,51 @@ def get_access_token_by_foursquare_access_token(self, fs__access__token): resource_path = "api/v2/access_token/foursquare" return self._lr_object.execute("GET", resource_path, query_parameters, None) + def get_access_token_by_apple_id_code(self, code, social_app_name=None): + """The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response. + + Args: + code: Apple Code + social_app_name: Name of Social provider APP + + Returns: + Response containing Definition of Complete Token data + 20.12 + """ + + if(self._lr_object.is_null_or_whitespace(code)): + raise Exception(self._lr_object.get_validation_message("code")) + + query_parameters = {} + query_parameters["code"] = code + query_parameters["key"] = self._lr_object.get_api_key() + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name + + resource_path = "api/v2/access_token/apple" + return self._lr_object.execute("GET", resource_path, query_parameters, None) + + def get_access_token_by_we_chat_code(self, code): + """This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. + + Args: + code: WeChat Code + + Returns: + Response containing Definition of Complete Token data + 20.13 + """ + + if(self._lr_object.is_null_or_whitespace(code)): + raise Exception(self._lr_object.get_validation_message("code")) + + query_parameters = {} + query_parameters["code"] = code + query_parameters["key"] = self._lr_object.get_api_key() + + resource_path = "api/v2/access_token/wechat" + return self._lr_object.execute("GET", resource_path, query_parameters, None) + def get_access_token_by_vkontakte_access_token(self, vk_access_token): """The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response. @@ -170,11 +228,12 @@ def get_access_token_by_vkontakte_access_token(self, vk_access_token): resource_path = "api/v2/access_token/vkontakte" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def get_access_token_by_google_auth_code(self, google_authcode): + def get_access_token_by_google_auth_code(self, google_authcode, social_app_name=None): """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. Args: google_authcode: Google AuthCode + social_app_name: Name of Social provider APP Returns: Response containing Definition of Complete Token data @@ -187,6 +246,8 @@ def get_access_token_by_google_auth_code(self, google_authcode): query_parameters = {} query_parameters["apiKey"] = self._lr_object.get_api_key() query_parameters["google_authcode"] = google_authcode + if(not self._lr_object.is_null_or_whitespace(social_app_name)): + query_parameters["socialAppName"] = social_app_name resource_path = "api/v2/access_token/google" return self._lr_object.execute("GET", resource_path, query_parameters, None) diff --git a/lib/LoginRadius/api/social/social_api.py b/lib/LoginRadius/api/social/social_api.py index 9b6550c..ea8a9c8 100644 --- a/lib/LoginRadius/api/social/social_api.py +++ b/lib/LoginRadius/api/social/social_api.py @@ -33,12 +33,13 @@ def exchange_access_token(self, token): resource_path = "api/v2/access_token" return self._lr_object.execute("GET", resource_path, query_parameters, None) - def refresh_access_token(self, access_token, expires_in=0): + def refresh_access_token(self, access_token, expires_in=0, is_web=False): """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. Args: access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - expires_in: Allows you to specify a desired expiration time in minutes for the newly issued access_token. + expires_in: Allows you to specify a desired expiration time in minutes for the newly issued access token. + is_web: Is web or not. Returns: Response containing Definition of Complete Token data @@ -53,6 +54,8 @@ def refresh_access_token(self, access_token, expires_in=0): query_parameters["secret"] = self._lr_object.get_api_secret() if(expires_in is not None): query_parameters["expiresIn"] = expires_in + if(is_web is not None): + query_parameters["isWeb"] = is_web resource_path = "api/v2/access_token/refresh" return self._lr_object.execute("GET", resource_path, query_parameters, None) diff --git a/lib/README.md b/lib/README.md index 4fdea27..cf24978 100644 --- a/lib/README.md +++ b/lib/README.md @@ -21,18 +21,38 @@ From Package Using pip ``` - pip install loginradius-v2==10.0.1 + pip install loginradius-v2==11.0.0 ``` or with easy_install ``` - easy_install loginradius-v2==10.0.1 + easy_install loginradius-v2==11.0.0 ``` Changelog ====== +11.0.0 +----------- +Release on **July 28,2020** + +## Enhancements: +- Added a parameter isWeb in "RefreshAccessToken" API. +- Added a parameter SocialAppName in "getAccessTokenByFacebookAccessToken, getAccessTokenByTwitterAccessToken, + getAccessTokenByGoogleAccessToken, getAccessTokenByLinkedinAccessToken, getAccessTokenByAppleIdCode, + getAccessTokenByGoogleAuthCode" Native Social login APIs. + +## Added new multiple APIs for better user experience: +- Added linkSocialIdentites(POST) API. +- Added linkSocialIdentitiesByPing(POST) API. +- Added getAccessTokenByAppleIdCode API. +- Added getAccessTokenByWeChatCode API. + +## Removed APIs: + - linkSocialIdentity API(PUT) + - getSocialIdentity API(GET) + 10.0.1 ----------- Release on **October 10,2019** diff --git a/lib/setup.py b/lib/setup.py index 22e613f..5f81688 100755 --- a/lib/setup.py +++ b/lib/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'LoginRadius-v2', - version='10.0.1', + version='11.0.0', long_description=long_description, long_description_content_type='text/markdown', packages=setuptools.find_packages(), From 0390bde43450851f722942ea827f15b464e0b982 Mon Sep 17 00:00:00 2001 From: ankit singh Date: Tue, 11 Aug 2020 11:58:04 +0530 Subject: [PATCH 2/2] Version 11.0.0 --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37608cb..3088524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # LoginRadius Python SDK Change Log # Version 11.0.0 -Release on **August 11,2020** +Released on **August 11,2020** ## Enhancements: - Added a parameter isWeb in "RefreshAccessToken" API. - Added a parameter SocialAppName in "getAccessTokenByFacebookAccessToken, getAccessTokenByTwitterAccessToken, @@ -19,12 +19,12 @@ Release on **August 11,2020** - getSocialIdentity API(GET) # Version 10.0.1 -Release on **Oct 24,2019** +Released on **Oct 24,2019** ## Enhancements - Fixed the pip installation issue # Version 10.0.0 -Release on **September 30,2019** +Released on **September 30,2019** ## Enhancements This full version release includes major breaking changes with several improvements and optimizations :