diff --git a/CHANGELOG.md b/CHANGELOG.md index e9013cd..96c52d5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,25 @@ > **LoginRadius Ruby On Rails SDK Change Log** provides information regarding what has changed, more specifically what changes, improvements and bug fix has been made to the SDK. For more details please refer to the [LoginRadius API Documention](https://docs.loginradius.com/api/v2/sdk-libraries/ruby) +### 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.0 Released on **Dec 19, 2019** diff --git a/README.md b/README.md index cf21c61..8c7b8c6 100755 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Or ```` - gem 'login_radius', '~> 10.0' + gem 'login_radius', '~> 11.0' ```` @@ -55,7 +55,6 @@ Or install it yourself as: $ gem install login_radius ```` - #### Usage 1)Before using any of the functions available in the library, its corresponding module must first define the global constant in `config/application.yml`: @@ -123,13 +122,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-)
@@ -144,7 +144,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-)
@@ -367,24 +366,6 @@ response = AuthenticationApi.change_password(access_token, new_password, old_pas -
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 - -response = AuthenticationApi.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/) @@ -510,6 +491,42 @@ response = AuthenticationApi.forgot_password(email, reset_password_url, email_te +
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 + +response = AuthenticationApi.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 + +response = AuthenticationApi.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) @@ -783,24 +800,6 @@ response = AuthenticationApi.verify_email(verification_token, fields, url, welco -
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 = nil #Optional - -response = AuthenticationApi.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/) @@ -922,7 +921,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-)
@@ -943,7 +941,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) @@ -1062,25 +1060,6 @@ response = AccountApi.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 - -response = AccountApi.account_update_uid(update_uid_model, uid) - - ``` - -
Account Create (POST)
@@ -1514,8 +1493,9 @@ response = SocialApi.exchange_access_token(token) access_token = "" #Required expires_in = 0 #Optional + is_web = true #Optional -response = SocialApi.refresh_access_token(access_token, expires_in) +response = SocialApi.refresh_access_token(access_token, expires_in, is_web) ``` @@ -3234,6 +3214,9 @@ List of APIs in this Section:
* PUT : [Validate MFA by Google Authenticator Code](#MFAReAuthenticateByGoogleAuth-put-)
* PUT : [Validate MFA by Password](#MFAReAuthenticateByPassword-put-)
* PUT : [MFA Re-authentication by PIN](#VerifyPINAuthentication-put-)
+* POST : [Verify Multifactor OTP Authentication](#VerifyMultiFactorOtpReauthentication-post-)
+* POST : [Verify Multifactor Password Authentication](#VerifyMultiFactorPasswordReauthentication-post-)
+* POST : [Verify Multifactor PIN Authentication](#VerifyMultiFactorPINReauthentication-post-)
* GET : [Multi Factor Re-Authenticate](#MFAReAuthenticate-get-)
@@ -3340,6 +3323,66 @@ response = ReAuthenticationApi.verify_pin_authentication(access_token, pin_auth_ +
Verify Multifactor OTP Authentication (POST)
+ This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by OTP. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/mfa/re-auth-validate-mfa/) + + + + + ``` + + + event_based_multi_factor_token ={ +"secondFactorValidationToken" => ""} #Required + uid = "" #Required + +response = ReAuthenticationApi.verify_multi_factor_otp_reauthentication(event_based_multi_factor_token, uid) + + ``` + + + + +
Verify Multifactor Password Authentication (POST)
+ This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by password. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/re-auth-validate-password/) + + + + + ``` + + + event_based_multi_factor_token ={ +"secondFactorValidationToken" => ""} #Required + uid = "" #Required + +response = ReAuthenticationApi.verify_multi_factor_password_reauthentication(event_based_multi_factor_token, uid) + + ``` + + + + +
Verify Multifactor PIN Authentication (POST)
+ This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by PIN. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/pin/re-auth-validate-pin/) + + + + + ``` + + + event_based_multi_factor_token ={ +"secondFactorValidationToken" => ""} #Required + uid = "" #Required + +response = ReAuthenticationApi.verify_multi_factor_pin_reauthentication(event_based_multi_factor_token, uid) + + ``` + + + +
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/) @@ -4473,6 +4516,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-)
@@ -4487,8 +4532,9 @@ List of APIs in this Section:
``` fb_access_token = "" #Required + social_app_name = "" #Optional -response = NativeSocialApi.get_access_token_by_facebook_access_token(fb_access_token) +response = NativeSocialApi.get_access_token_by_facebook_access_token(fb_access_token, social_app_name) ``` @@ -4505,8 +4551,9 @@ response = NativeSocialApi.get_access_token_by_facebook_access_token(fb_access_t tw_access_token = "" #Required tw_token_secret = "" #Required + social_app_name = "" #Optional -response = NativeSocialApi.get_access_token_by_twitter_access_token(tw_access_token, tw_token_secret) +response = NativeSocialApi.get_access_token_by_twitter_access_token(tw_access_token, tw_token_secret, social_app_name) ``` @@ -4524,8 +4571,9 @@ response = NativeSocialApi.get_access_token_by_twitter_access_token(tw_access_to google_access_token = "" #Required client_id = "" #Optional refresh_token = "" #Optional + social_app_name = "" #Optional -response = NativeSocialApi.get_access_token_by_google_access_token(google_access_token, client_id, refresh_token) +response = NativeSocialApi.get_access_token_by_google_access_token(google_access_token, client_id, refresh_token, social_app_name) ``` @@ -4558,8 +4606,9 @@ response = NativeSocialApi.get_access_token_by_google_j_w_t_access_token(id_toke ``` ln_access_token = "" #Required + social_app_name = "" #Optional -response = NativeSocialApi.get_access_token_by_linkedin_access_token(ln_access_token) +response = NativeSocialApi.get_access_token_by_linkedin_access_token(ln_access_token, social_app_name) ``` @@ -4583,6 +4632,41 @@ response = NativeSocialApi.get_access_token_by_foursquare_access_token(fs_access +
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 + +response = NativeSocialApi.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 + +response = NativeSocialApi.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) @@ -4609,8 +4693,9 @@ response = NativeSocialApi.get_access_token_by_vkontakte_access_token(vk_access_ ``` google_authcode = "" #Required + social_app_name = "" #Optional -response = NativeSocialApi.get_access_token_by_google_auth_code(google_authcode) +response = NativeSocialApi.get_access_token_by_google_auth_code(google_authcode, social_app_name) ``` @@ -4706,79 +4791,6 @@ response = WebHookApi.web_hook_unsubscribe(web_hook_subscribe_model) -### ReAuthentication API - - -List of APIs in this Section:
- -* POST : [Verify Multifactor OTP Authentication](#VerifyMultiFactorOtpReauthentication-post-)
-* POST : [Verify Multifactor Password Authentication](#VerifyMultiFactorPasswordReauthentication-post-)
-* POST : [Verify Multifactor PIN Authentication](#VerifyMultiFactorPINReauthentication-post-)
- - - -
Verify Multifactor OTP Authentication (POST)
- This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by OTP. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/mfa/re-auth-validate-mfa/) - - - - - ``` - - - event_based_multi_factor_token ={ -"secondFactorValidationToken" => ""} #Required - uid = "" #Required - -response = ReAuthenticationApi.verify_multi_factor_otp_reauthentication(event_based_multi_factor_token, uid) - - ``` - - - - -
Verify Multifactor Password Authentication (POST)
- This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by password. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/re-auth-validate-password/) - - - - - ``` - - - event_based_multi_factor_token ={ -"secondFactorValidationToken" => ""} #Required - uid = "" #Required - -response = ReAuthenticationApi.verify_multi_factor_password_reauthentication(event_based_multi_factor_token, uid) - - ``` - - - - -
Verify Multifactor PIN Authentication (POST)
- This API is used on the server-side to validate and verify the re-authentication token created by the MFA re-authentication API. This API checks re-authentications created by PIN. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/pin/re-auth-validate-pin/) - - - - - ``` - - - event_based_multi_factor_token ={ -"secondFactorValidationToken" => ""} #Required - uid = "" #Required - -response = ReAuthenticationApi.verify_multi_factor_pin_reauthentication(event_based_multi_factor_token, uid) - - ``` - - - - - - ### Demo We have a demo web application using the Ruby SDK, which includes the following features: @@ -4811,4 +4823,5 @@ SET UP: 2. Run `bundle exec figaro install`, then configure the generated `/config/application.yml` based on `config/application.yml.example` 3. Run the server using `rails server` -To configure the login screen implementation, create `options.js` in `/public/js` based on the example provided in `/public/options.js.sample` + +To configure the login screen implementation, create `options.js` in `/public/js` based on the example provided in `/public/options.js.sample` \ No newline at end of file diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index a4e966a..4b0b8b3 100755 --- a/demo/Gemfile.lock +++ b/demo/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: vendor/gems/login_radius specs: - login_radius (10.0.0) + login_radius (11.0.0) GEM remote: https://rubygems.org/ diff --git a/demo/vendor/gems/login_radius/README.md b/demo/vendor/gems/login_radius/README.md index bc9d612..7ec2a9c 100644 --- a/demo/vendor/gems/login_radius/README.md +++ b/demo/vendor/gems/login_radius/README.md @@ -3,7 +3,7 @@ Install the SDK by adding LoginRadius to your application's `Gemfile`. ``` -gem 'login_radius', '= 10.0.0' +gem 'login_radius', '= 11.0.0' ``` Then, run `$ bundle`. A copy of the SDK can also be found on our [Github](https://github.com/LoginRadius/ruby-on-rails-gem/tree/master). diff --git a/demo/vendor/gems/login_radius/lib/login_radius/api/authentication/authentication_api.rb b/demo/vendor/gems/login_radius/lib/login_radius/api/authentication/authentication_api.rb index 33326bd..57eec5b 100644 --- a/demo/vendor/gems/login_radius/lib/login_radius/api/authentication/authentication_api.rb +++ b/demo/vendor/gems/login_radius/lib/login_radius/api/authentication/authentication_api.rb @@ -702,19 +702,23 @@ def change_password(access_token, new_password, old_password) put_request(resource_path, query_parameters, body_parameters) end - # 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. + # 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. # # @param access_token - Access_Token - # @param candidate_token - Access token of the account to be linked + # @param provider - Name of the provider + # @param provider_id - Unique ID of the linked account # - # @return Response containing Definition of Complete Validation data - # 12.1 - def link_social_identities(access_token, candidate_token) + # @return Response containing Definition of Delete Request + # 12.2 + def unlink_social_identities(access_token, provider, provider_id) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end - if isNullOrWhiteSpace(candidate_token) - raise LoginRadius::Error.new, getValidationMessage('candidate_token') + if isNullOrWhiteSpace(provider) + raise LoginRadius::Error.new, getValidationMessage('provider') + end + if isNullOrWhiteSpace(provider_id) + raise LoginRadius::Error.new, getValidationMessage('provider_id') end query_parameters = {} @@ -722,29 +726,26 @@ def link_social_identities(access_token, candidate_token) query_parameters['apiKey'] = @api_key body_parameters = {} - body_parameters['candidateToken'] = candidate_token + body_parameters['provider'] = provider + body_parameters['providerId'] = provider_id resource_path = 'identity/v2/auth/socialidentity' - put_request(resource_path, query_parameters, body_parameters) + delete_request(resource_path, query_parameters, body_parameters) end - # 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. + # 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. # - # @param access_token - Access_Token - # @param provider - Name of the provider - # @param provider_id - Unique ID of the linked account + # @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + # @param candidate_token - Access token of the account to be linked # - # @return Response containing Definition of Delete Request - # 12.2 - def unlink_social_identities(access_token, provider, provider_id) + # @return Response containing Definition of Complete Validation data + # 12.4 + def link_social_identities(access_token, candidate_token) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end - if isNullOrWhiteSpace(provider) - raise LoginRadius::Error.new, getValidationMessage('provider') - end - if isNullOrWhiteSpace(provider_id) - raise LoginRadius::Error.new, getValidationMessage('provider_id') + if isNullOrWhiteSpace(candidate_token) + raise LoginRadius::Error.new, getValidationMessage('candidate_token') end query_parameters = {} @@ -752,34 +753,36 @@ def unlink_social_identities(access_token, provider, provider_id) query_parameters['apiKey'] = @api_key body_parameters = {} - body_parameters['provider'] = provider - body_parameters['providerId'] = provider_id + body_parameters['candidateToken'] = candidate_token resource_path = 'identity/v2/auth/socialidentity' - delete_request(resource_path, query_parameters, body_parameters) + post_request(resource_path, query_parameters, body_parameters) end - # This API is called just after account linking API and it prevents the raas profile of the second account from getting created. + # 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. # # @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields + # @param client_guid - Unique ID generated by client # - # @return Response containing Definition for Complete SocialUserProfile data - # 12.3 - def get_social_identity(access_token, fields = '') + # @return Response containing Definition of Complete Validation data + # 12.5 + def link_social_identities_by_ping(access_token, client_guid) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end + if isNullOrWhiteSpace(client_guid) + raise LoginRadius::Error.new, getValidationMessage('client_guid') + end query_parameters = {} query_parameters['access_token'] = access_token query_parameters['apiKey'] = @api_key - unless isNullOrWhiteSpace(fields) - query_parameters['fields'] = fields - end + + body_parameters = {} + body_parameters['clientGuid'] = client_guid resource_path = 'identity/v2/auth/socialidentity' - get_request(resource_path, query_parameters, nil) + post_request(resource_path, query_parameters, body_parameters) end # This API is used to set or change UserName by access token. diff --git a/demo/vendor/gems/login_radius/lib/login_radius/api/social/native_social_api.rb b/demo/vendor/gems/login_radius/lib/login_radius/api/social/native_social_api.rb index 3e0e25a..6e3ca92 100644 --- a/demo/vendor/gems/login_radius/lib/login_radius/api/social/native_social_api.rb +++ b/demo/vendor/gems/login_radius/lib/login_radius/api/social/native_social_api.rb @@ -28,10 +28,11 @@ def initialize # 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. # # @param fb__access__token - Facebook Access Token + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.3 - def get_access_token_by_facebook_access_token(fb__access__token) + def get_access_token_by_facebook_access_token(fb__access__token, social_app_name = '') if isNullOrWhiteSpace(fb__access__token) raise LoginRadius::Error.new, getValidationMessage('fb__access__token') end @@ -39,6 +40,9 @@ def get_access_token_by_facebook_access_token(fb__access__token) query_parameters = {} query_parameters['fb_Access_Token'] = fb__access__token query_parameters['key'] = @api_key + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/facebook' get_request(resource_path, query_parameters, nil) @@ -48,10 +52,11 @@ def get_access_token_by_facebook_access_token(fb__access__token) # # @param tw__access__token - Twitter Access Token # @param tw__token__secret - Twitter Token Secret + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.4 - def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret) + def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret, social_app_name = '') if isNullOrWhiteSpace(tw__access__token) raise LoginRadius::Error.new, getValidationMessage('tw__access__token') end @@ -63,6 +68,9 @@ def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secre query_parameters['key'] = @api_key query_parameters['tw_Access_Token'] = tw__access__token query_parameters['tw_Token_Secret'] = tw__token__secret + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/twitter' get_request(resource_path, query_parameters, nil) @@ -73,10 +81,11 @@ def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secre # @param google__access__token - Google Access Token # @param client_id - Google Client ID # @param refresh_token - LoginRadius refresh token + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.5 - def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '') + def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '', social_app_name = '') if isNullOrWhiteSpace(google__access__token) raise LoginRadius::Error.new, getValidationMessage('google__access__token') end @@ -90,6 +99,9 @@ def get_access_token_by_google_access_token(google__access__token, client_id = ' unless isNullOrWhiteSpace(refresh_token) query_parameters['refresh_token'] = refresh_token end + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/google' get_request(resource_path, query_parameters, nil) @@ -117,10 +129,11 @@ def get_access_token_by_google_j_w_t_access_token(id__token) # 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. # # @param ln__access__token - Linkedin Access Token + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.7 - def get_access_token_by_linkedin_access_token(ln__access__token) + def get_access_token_by_linkedin_access_token(ln__access__token, social_app_name = '') if isNullOrWhiteSpace(ln__access__token) raise LoginRadius::Error.new, getValidationMessage('ln__access__token') end @@ -128,6 +141,9 @@ def get_access_token_by_linkedin_access_token(ln__access__token) query_parameters = {} query_parameters['key'] = @api_key query_parameters['ln_Access_Token'] = ln__access__token + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/linkedin' get_request(resource_path, query_parameters, nil) @@ -152,6 +168,48 @@ def get_access_token_by_foursquare_access_token(fs__access__token) get_request(resource_path, query_parameters, nil) end + # 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. + # + # @param code - Apple Code + # @param social_app_name - Name of Social provider APP + # + # @return Response containing Definition of Complete Token data + # 20.12 + def get_access_token_by_apple_id_code(code, social_app_name = '') + if isNullOrWhiteSpace(code) + raise LoginRadius::Error.new, getValidationMessage('code') + end + + query_parameters = {} + query_parameters['code'] = code + query_parameters['key'] = @api_key + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end + + resource_path = 'api/v2/access_token/apple' + get_request(resource_path, query_parameters, nil) + end + + # This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. + # + # @param code - WeChat Code + # + # @return Response containing Definition of Complete Token data + # 20.13 + def get_access_token_by_we_chat_code(code) + if isNullOrWhiteSpace(code) + raise LoginRadius::Error.new, getValidationMessage('code') + end + + query_parameters = {} + query_parameters['code'] = code + query_parameters['key'] = @api_key + + resource_path = 'api/v2/access_token/wechat' + get_request(resource_path, query_parameters, nil) + end + # 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. # # @param vk_access_token - Vkontakte Access Token @@ -174,10 +232,11 @@ def get_access_token_by_vkontakte_access_token(vk_access_token) # 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. # # @param google_authcode - Google AuthCode + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.16 - def get_access_token_by_google_auth_code(google_authcode) + def get_access_token_by_google_auth_code(google_authcode, social_app_name = '') if isNullOrWhiteSpace(google_authcode) raise LoginRadius::Error.new, getValidationMessage('google_authcode') end @@ -185,6 +244,9 @@ def get_access_token_by_google_auth_code(google_authcode) query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['google_authcode'] = google_authcode + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/google' get_request(resource_path, query_parameters, nil) diff --git a/demo/vendor/gems/login_radius/lib/login_radius/api/social/social_api.rb b/demo/vendor/gems/login_radius/lib/login_radius/api/social/social_api.rb index 21df66f..926efc4 100644 --- a/demo/vendor/gems/login_radius/lib/login_radius/api/social/social_api.rb +++ b/demo/vendor/gems/login_radius/lib/login_radius/api/social/social_api.rb @@ -48,10 +48,11 @@ def exchange_access_token(token) # # @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication. # @param expires_in - Allows you to specify a desired expiration time in minutes for the newly issued access token. + # @param is_web - Is web or not. # # @return Response containing Definition of Complete Token data # 20.2 - def refresh_access_token(access_token, expires_in) + def refresh_access_token(access_token, expires_in, is_web = false) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end @@ -62,6 +63,9 @@ def refresh_access_token(access_token, expires_in) unless expires_in == false query_parameters['expiresIn'] = expires_in end + unless is_web == false + query_parameters['isWeb'] = is_web + end resource_path = 'api/v2/access_token/refresh' get_request(resource_path, query_parameters, nil) diff --git a/demo/vendor/gems/login_radius/lib/login_radius/version.rb b/demo/vendor/gems/login_radius/lib/login_radius/version.rb index 520a835..1c9e644 100644 --- a/demo/vendor/gems/login_radius/lib/login_radius/version.rb +++ b/demo/vendor/gems/login_radius/lib/login_radius/version.rb @@ -1,3 +1,3 @@ module LoginRadius - VERSION = "10.0.0" + VERSION = "11.0.0" end \ No newline at end of file diff --git a/sdk/src/login_radius/README.md b/sdk/src/login_radius/README.md index 49c9ea8..6e8d25b 100644 --- a/sdk/src/login_radius/README.md +++ b/sdk/src/login_radius/README.md @@ -3,7 +3,7 @@ Install the SDK by adding LoginRadius to your application's `Gemfile`. ``` -gem 'login_radius', '~> 10.0' +gem 'login_radius', '~> 11.0' ``` Then, run `$ bundle`. A copy of the SDK can also be found on our [Github](https://github.com/LoginRadius/ruby-on-rails-gem/tree/master). diff --git a/sdk/src/login_radius/lib/login_radius/api/authentication/authentication_api.rb b/sdk/src/login_radius/lib/login_radius/api/authentication/authentication_api.rb index 33326bd..57eec5b 100644 --- a/sdk/src/login_radius/lib/login_radius/api/authentication/authentication_api.rb +++ b/sdk/src/login_radius/lib/login_radius/api/authentication/authentication_api.rb @@ -702,19 +702,23 @@ def change_password(access_token, new_password, old_password) put_request(resource_path, query_parameters, body_parameters) end - # 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. + # 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. # # @param access_token - Access_Token - # @param candidate_token - Access token of the account to be linked + # @param provider - Name of the provider + # @param provider_id - Unique ID of the linked account # - # @return Response containing Definition of Complete Validation data - # 12.1 - def link_social_identities(access_token, candidate_token) + # @return Response containing Definition of Delete Request + # 12.2 + def unlink_social_identities(access_token, provider, provider_id) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end - if isNullOrWhiteSpace(candidate_token) - raise LoginRadius::Error.new, getValidationMessage('candidate_token') + if isNullOrWhiteSpace(provider) + raise LoginRadius::Error.new, getValidationMessage('provider') + end + if isNullOrWhiteSpace(provider_id) + raise LoginRadius::Error.new, getValidationMessage('provider_id') end query_parameters = {} @@ -722,29 +726,26 @@ def link_social_identities(access_token, candidate_token) query_parameters['apiKey'] = @api_key body_parameters = {} - body_parameters['candidateToken'] = candidate_token + body_parameters['provider'] = provider + body_parameters['providerId'] = provider_id resource_path = 'identity/v2/auth/socialidentity' - put_request(resource_path, query_parameters, body_parameters) + delete_request(resource_path, query_parameters, body_parameters) end - # 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. + # 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. # - # @param access_token - Access_Token - # @param provider - Name of the provider - # @param provider_id - Unique ID of the linked account + # @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + # @param candidate_token - Access token of the account to be linked # - # @return Response containing Definition of Delete Request - # 12.2 - def unlink_social_identities(access_token, provider, provider_id) + # @return Response containing Definition of Complete Validation data + # 12.4 + def link_social_identities(access_token, candidate_token) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end - if isNullOrWhiteSpace(provider) - raise LoginRadius::Error.new, getValidationMessage('provider') - end - if isNullOrWhiteSpace(provider_id) - raise LoginRadius::Error.new, getValidationMessage('provider_id') + if isNullOrWhiteSpace(candidate_token) + raise LoginRadius::Error.new, getValidationMessage('candidate_token') end query_parameters = {} @@ -752,34 +753,36 @@ def unlink_social_identities(access_token, provider, provider_id) query_parameters['apiKey'] = @api_key body_parameters = {} - body_parameters['provider'] = provider - body_parameters['providerId'] = provider_id + body_parameters['candidateToken'] = candidate_token resource_path = 'identity/v2/auth/socialidentity' - delete_request(resource_path, query_parameters, body_parameters) + post_request(resource_path, query_parameters, body_parameters) end - # This API is called just after account linking API and it prevents the raas profile of the second account from getting created. + # 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. # # @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields + # @param client_guid - Unique ID generated by client # - # @return Response containing Definition for Complete SocialUserProfile data - # 12.3 - def get_social_identity(access_token, fields = '') + # @return Response containing Definition of Complete Validation data + # 12.5 + def link_social_identities_by_ping(access_token, client_guid) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end + if isNullOrWhiteSpace(client_guid) + raise LoginRadius::Error.new, getValidationMessage('client_guid') + end query_parameters = {} query_parameters['access_token'] = access_token query_parameters['apiKey'] = @api_key - unless isNullOrWhiteSpace(fields) - query_parameters['fields'] = fields - end + + body_parameters = {} + body_parameters['clientGuid'] = client_guid resource_path = 'identity/v2/auth/socialidentity' - get_request(resource_path, query_parameters, nil) + post_request(resource_path, query_parameters, body_parameters) end # This API is used to set or change UserName by access token. diff --git a/sdk/src/login_radius/lib/login_radius/api/social/native_social_api.rb b/sdk/src/login_radius/lib/login_radius/api/social/native_social_api.rb index 3e0e25a..6e3ca92 100644 --- a/sdk/src/login_radius/lib/login_radius/api/social/native_social_api.rb +++ b/sdk/src/login_radius/lib/login_radius/api/social/native_social_api.rb @@ -28,10 +28,11 @@ def initialize # 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. # # @param fb__access__token - Facebook Access Token + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.3 - def get_access_token_by_facebook_access_token(fb__access__token) + def get_access_token_by_facebook_access_token(fb__access__token, social_app_name = '') if isNullOrWhiteSpace(fb__access__token) raise LoginRadius::Error.new, getValidationMessage('fb__access__token') end @@ -39,6 +40,9 @@ def get_access_token_by_facebook_access_token(fb__access__token) query_parameters = {} query_parameters['fb_Access_Token'] = fb__access__token query_parameters['key'] = @api_key + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/facebook' get_request(resource_path, query_parameters, nil) @@ -48,10 +52,11 @@ def get_access_token_by_facebook_access_token(fb__access__token) # # @param tw__access__token - Twitter Access Token # @param tw__token__secret - Twitter Token Secret + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.4 - def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret) + def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret, social_app_name = '') if isNullOrWhiteSpace(tw__access__token) raise LoginRadius::Error.new, getValidationMessage('tw__access__token') end @@ -63,6 +68,9 @@ def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secre query_parameters['key'] = @api_key query_parameters['tw_Access_Token'] = tw__access__token query_parameters['tw_Token_Secret'] = tw__token__secret + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/twitter' get_request(resource_path, query_parameters, nil) @@ -73,10 +81,11 @@ def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secre # @param google__access__token - Google Access Token # @param client_id - Google Client ID # @param refresh_token - LoginRadius refresh token + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.5 - def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '') + def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '', social_app_name = '') if isNullOrWhiteSpace(google__access__token) raise LoginRadius::Error.new, getValidationMessage('google__access__token') end @@ -90,6 +99,9 @@ def get_access_token_by_google_access_token(google__access__token, client_id = ' unless isNullOrWhiteSpace(refresh_token) query_parameters['refresh_token'] = refresh_token end + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/google' get_request(resource_path, query_parameters, nil) @@ -117,10 +129,11 @@ def get_access_token_by_google_j_w_t_access_token(id__token) # 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. # # @param ln__access__token - Linkedin Access Token + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.7 - def get_access_token_by_linkedin_access_token(ln__access__token) + def get_access_token_by_linkedin_access_token(ln__access__token, social_app_name = '') if isNullOrWhiteSpace(ln__access__token) raise LoginRadius::Error.new, getValidationMessage('ln__access__token') end @@ -128,6 +141,9 @@ def get_access_token_by_linkedin_access_token(ln__access__token) query_parameters = {} query_parameters['key'] = @api_key query_parameters['ln_Access_Token'] = ln__access__token + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/linkedin' get_request(resource_path, query_parameters, nil) @@ -152,6 +168,48 @@ def get_access_token_by_foursquare_access_token(fs__access__token) get_request(resource_path, query_parameters, nil) end + # 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. + # + # @param code - Apple Code + # @param social_app_name - Name of Social provider APP + # + # @return Response containing Definition of Complete Token data + # 20.12 + def get_access_token_by_apple_id_code(code, social_app_name = '') + if isNullOrWhiteSpace(code) + raise LoginRadius::Error.new, getValidationMessage('code') + end + + query_parameters = {} + query_parameters['code'] = code + query_parameters['key'] = @api_key + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end + + resource_path = 'api/v2/access_token/apple' + get_request(resource_path, query_parameters, nil) + end + + # This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code. + # + # @param code - WeChat Code + # + # @return Response containing Definition of Complete Token data + # 20.13 + def get_access_token_by_we_chat_code(code) + if isNullOrWhiteSpace(code) + raise LoginRadius::Error.new, getValidationMessage('code') + end + + query_parameters = {} + query_parameters['code'] = code + query_parameters['key'] = @api_key + + resource_path = 'api/v2/access_token/wechat' + get_request(resource_path, query_parameters, nil) + end + # 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. # # @param vk_access_token - Vkontakte Access Token @@ -174,10 +232,11 @@ def get_access_token_by_vkontakte_access_token(vk_access_token) # 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. # # @param google_authcode - Google AuthCode + # @param social_app_name - Name of Social provider APP # # @return Response containing Definition of Complete Token data # 20.16 - def get_access_token_by_google_auth_code(google_authcode) + def get_access_token_by_google_auth_code(google_authcode, social_app_name = '') if isNullOrWhiteSpace(google_authcode) raise LoginRadius::Error.new, getValidationMessage('google_authcode') end @@ -185,6 +244,9 @@ def get_access_token_by_google_auth_code(google_authcode) query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['google_authcode'] = google_authcode + unless isNullOrWhiteSpace(social_app_name) + query_parameters['socialAppName'] = social_app_name + end resource_path = 'api/v2/access_token/google' get_request(resource_path, query_parameters, nil) diff --git a/sdk/src/login_radius/lib/login_radius/api/social/social_api.rb b/sdk/src/login_radius/lib/login_radius/api/social/social_api.rb index 21df66f..926efc4 100644 --- a/sdk/src/login_radius/lib/login_radius/api/social/social_api.rb +++ b/sdk/src/login_radius/lib/login_radius/api/social/social_api.rb @@ -48,10 +48,11 @@ def exchange_access_token(token) # # @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication. # @param expires_in - Allows you to specify a desired expiration time in minutes for the newly issued access token. + # @param is_web - Is web or not. # # @return Response containing Definition of Complete Token data # 20.2 - def refresh_access_token(access_token, expires_in) + def refresh_access_token(access_token, expires_in, is_web = false) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end @@ -62,6 +63,9 @@ def refresh_access_token(access_token, expires_in) unless expires_in == false query_parameters['expiresIn'] = expires_in end + unless is_web == false + query_parameters['isWeb'] = is_web + end resource_path = 'api/v2/access_token/refresh' get_request(resource_path, query_parameters, nil) diff --git a/sdk/src/login_radius/lib/login_radius/version.rb b/sdk/src/login_radius/lib/login_radius/version.rb index 520a835..1c9e644 100644 --- a/sdk/src/login_radius/lib/login_radius/version.rb +++ b/sdk/src/login_radius/lib/login_radius/version.rb @@ -1,3 +1,3 @@ module LoginRadius - VERSION = "10.0.0" + VERSION = "11.0.0" end \ No newline at end of file