diff --git a/CHANGELOG.md b/CHANGELOG.md index 06df0fe..876b572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,61 @@ > **LoginRadius PHP 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://www.loginradius.com/docs/api/v2/deployment/sdk-libraries/php-library/) +# Version 11.6.0 + +Release on **July 03, 2024** + +## Added following APIs: +- `MFAValidateAuthenticatorCode` +- `MFAVerifyAuthenticatorCode` +- `RevokeAllRefreshToken ` +- `MultipurposeEmailTokenGeneration` +- `MultipurposeSMSOTPGeneration` +- `MFAReAuthenticateByAuthenticatorCode` +- `AuthSendVerificationEmailForLinkingSocialProfiles ` +- `SlidingAccessToken` +- `AccessTokenViaCustomJWTToken` +- `MFAResetAuthenticatorByToken` +- `MFAResetAuthenticatorByUid` + +## Enhancements +- Added `isVoiceOtp` parameter in `ResetPhoneIDVerificationByUid` API +- Added `isVoiceOtp` parameter in `MFAConfigureByAccessToken` API +- Added `isVoiceOtp` and `options` parameter in `MFAUpdatePhoneNumberByToken` API +- Added `isVoiceOtp`, `emailTemplate2FA` and `options` parameter in `MFALoginByEmail` API +- Added `isVoiceOtp` and `emailTemplate2FA` parameter in `MFALoginByUserName` API +- Added `isVoiceOtp` , `emailTemplate2FA` and `options` parameter in `MFALoginByPhone` API +- Added `isVoiceOtp` and `options` parameter in `MFAUpdatePhoneNumber` API +- Added `isVoiceOtp` parameter in `MFAResendOTP` API +- Added `isVoiceOtp` parameter in `MFAReAuthenticate` API +- Added `isVoiceOtp` and `options` parameter in `UpdateProfileByAccessToken` API +- Added `isVoiceOtp` parameter in `UserRegistrationByEmail` API +- Added `isVoiceOtp` parameter in `UserRegistrationByCaptcha` API +- Added `isVoiceOtp` parameter in `OneTouchLoginByPhone` API +- Added `isVoiceOtp` parameter in `PasswordlessLoginPhoneVerification` API +- Added `isVoiceOtp` parameter in `PasswordlessLoginByPhone` API +- Added `isVoiceOtp` parameter in `ForgotPasswordByPhoneOTP` API +- Added `isVoiceOtp` parameter in `PhoneVerificationByOTP` API +- Added `isVoiceOtp` parameter in `PhoneVerificationOTPByAccessToken` API +- Added `isVoiceOtp` parameter in `PhoneResendVerificationOTP` API +- Added `isVoiceOtp` parameter in `UpdatePhoneNumber` API +- Added `isVoiceOtp` and `emailTemplate` parameter in `UserRegistrationByPhone` API +- Added `isVoiceOtp` parameter in `SendForgotPINSMSByPhone` API +- Added `uuid` parameter in `VerifyEmail` API + +## Removed the following parameter + +-`smsTemplate2FA` parameter in `MFAConfigureByAccessToken` API + + + +## Removed (Deprecated) APIs: +- `MFAValidateGoogleAuthCode` +- `MFAReAuthenticateByGoogleAuth` +- `MFAResetGoogleAuthByToken ` +- `MFAResetGoogleAuthenticatorByUid` +- `MFAUpdateByAccessToken` + # Version 11.5.0 Release on **January 20, 2023** diff --git a/README.md b/README.md index 7021d67..a94d0af 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ curl -sS https://getcomposer.org/installer | php Next, run the Composer command to install the latest stable version of library: ``` -composer require loginradius/php-sdk:11.5.0 +composer require loginradius/php-sdk:11.6.0 ``` Include the following files in your Project Directory @@ -70,6 +70,8 @@ require_once "src/LoginRadiusSDK/CustomerRegistration/Advanced/WebHookAPI.php"; require_once "src/LoginRadiusSDK/CustomerRegistration/Social/NativeSocialAPI.php"; require_once "src/LoginRadiusSDK/CustomerRegistration/Social/SocialAPI.php"; +require_once "../../src/LoginRadiusSDK/CustomerRegistration/Authentication/SlidingTokenAPI.php"; + ``` Modify the config.php file in the SDK to include your LoginRadius Credentials @@ -135,6 +137,7 @@ use \LoginRadiusSDK\CustomerRegistration\Authentication\RiskBasedAuthenticationA use \LoginRadiusSDK\CustomerRegistration\Authentication\SmartLoginAPI; use \LoginRadiusSDK\CustomerRegistration\Social\SocialAPI; use \LoginRadiusSDK\CustomerRegistration\Social\NativeSocialAPI; +use \LoginRadiusSDK\CustomerRegistration\Authentication\SlidingTokenAPI; ``` @@ -216,6 +219,7 @@ List of APIs in this Section:
[GET : Auth Check UserName Availability](#CheckUserNameAvailability-get-)
[GET : Auth Privacy Policy Accept](#AcceptPrivacyPolicy-get-)
[GET : Auth Privacy Policy History By Access Token](#GetPrivacyPolicyHistoryByAccessToken-get-)
+[GET : Auth send verification Email for linking social profiles](#AuthSendVerificationEmailForLinkingSocialProfiles-get-)
[DELETE : Auth Delete Account with Email Confirmation](#DeleteAccountWithEmailConfirmation-delete-)
[DELETE : Auth Remove Email](#RemoveEmail-delete-)
[DELETE : Auth Unlink Social Identities](#UnlinkSocialIdentities-delete-)
@@ -241,11 +245,13 @@ $access_token = "access_token"; //Required }'; //Required $emailTemplate = "emailTemplate"; //Optional $fields = null; //Optional -$nullSupport = "true"; //Optional +$nullSupport = true; //Optional $smsTemplate = "smsTemplate"; //Optional -$verificationUrl = "verificationUrl"; //Optional +$verificationUrl = "verificationUrl"; //Optional +$isVoiceOtp = false; //Optional +$options = "options"; //Optional -$result = $authenticationAPI->updateProfileByAccessToken($access_token,$payload,$emailTemplate,$fields,$nullSupport,$smsTemplate,$verificationUrl); +$result = $authenticationAPI->updateProfileByAccessToken($access_token,$payload,$emailTemplate,$fields,$nullSupport,$smsTemplate,$verificationUrl,$isVoiceOtp,$options); ``` @@ -568,9 +574,10 @@ $emailTemplate = "emailTemplate"; //Optional $fields = null; //Optional $options = "options"; //Optional $verificationUrl = "verificationUrl"; //Optional -$welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional +$welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $authenticationAPI->userRegistrationByEmail($payload,$sott,$emailTemplate,$fields,$options,$verificationUrl,$welcomeEmailTemplate); +$result = $authenticationAPI->userRegistrationByEmail($payload,$sott,$emailTemplate,$fields,$options,$verificationUrl,$welcomeEmailTemplate,$isVoiceOtp); ``` @@ -597,9 +604,10 @@ $fields = null; //Optional $options = "options"; //Optional $smsTemplate = "smsTemplate"; //Optional $verificationUrl = "verificationUrl"; //Optional -$welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional +$welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $authenticationAPI->userRegistrationByCaptcha($payload,$emailTemplate,$fields,$options,$smsTemplate,$verificationUrl,$welcomeEmailTemplate); +$result = $authenticationAPI->userRegistrationByCaptcha($payload,$emailTemplate,$fields,$options,$smsTemplate,$verificationUrl,$welcomeEmailTemplate,$isVoiceOtp); ``` @@ -682,7 +690,7 @@ This api call invalidates the active access token or expires an access token's v ```php $access_token = "access_token"; //Required -$preventRefresh = "true"; //Optional +$preventRefresh = true; //Optional $result = $authenticationAPI->authInValidateAccessToken($access_token,$preventRefresh); ``` @@ -791,8 +799,9 @@ $verificationToken = "verificationToken"; //Required $fields = null; //Optional $url = "url"; //Optional $welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional - -$result = $authenticationAPI->verifyEmail($verificationToken,$fields,$url,$welcomeEmailTemplate); +$uuid = "uuid"; //Optional + +$result = $authenticationAPI->verifyEmail($verificationToken,$fields,$url,$welcomeEmailTemplate,$uuid); ``` @@ -824,6 +833,19 @@ $fields = null; //Optional $result = $authenticationAPI->acceptPrivacyPolicy($access_token,$fields); ``` +
Auth send verification Email for linking social profiles (GET)
+ + This API is used to Send verification email to the unverified email of the social profile. This API can be used only incase of optional verification workflow. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-send-verification-for-social-email/) + + + ```php + +$access_token = "access_token"; //Required +$clientguid = "clientguid"; //Required + +$result = $authenticationAPI->authSendVerificationEmailForLinkingSocialProfiles($access_token,$clientguid); + ``` +
Auth Privacy Policy History By Access Token (GET)
@@ -902,6 +924,8 @@ List of APIs in this Section:
[POST : Account Create](#CreateAccount-post-)
[POST : Forgot Password token](#GetForgotPasswordToken-post-)
[POST : Email Verification token](#GetEmailVerificationToken-post-)
+[POST : Multipurpose Email Token Generation API](#MultipurposeEmailTokenGeneration-post-)
+[POST : Multipurpose SMS OTP Generation API](#MultipurposeSMSOTPGeneration-post-)
[GET : Get Privacy Policy History By Uid](#GetPrivacyPolicyHistoryByUid-get-)
[GET : Account Profiles by Email](#GetAccountProfileByEmail-get-)
[GET : Account Profiles by Username](#GetAccountProfileByUserName-get-)
@@ -914,6 +938,7 @@ List of APIs in this Section:
[GET : Account Identities by Email](#GetAccountIdentitiesByEmail-get-)
[DELETE : Account Delete](#DeleteAccountByUid-delete-)
[DELETE : Account Remove Email](#RemoveEmail-delete-)
+[DELETE : Revoke All Refresh Token](#RevokeAllRefreshToken-delete-)
[DELETE : Delete User Profiles By Email](#AccountDeleteByEmail-delete-)
If you have not already initialized the Account object do so now @@ -936,7 +961,7 @@ This API is used to update the information of existing accounts in your Cloud St }'; //Required $uid = "uid"; //Required $fields = null; //Optional -$nullSupport = "true"; //Optional +$nullSupport = true; //Optional $result = $accountAPI->updateAccountByUid($payload,$uid,$fields,$nullSupport); ``` @@ -998,9 +1023,10 @@ This API Allows you to reset the phone no verification of an end user’s accoun ```php $uid = "uid"; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $accountAPI->resetPhoneIDVerificationByUid($uid,$smsTemplate); +$result = $accountAPI->resetPhoneIDVerificationByUid($uid,$smsTemplate,$isVoiceOtp); ``` @@ -1073,7 +1099,7 @@ This API Returns a Forgot Password Token it can also be used to send a Forgot Pa $email = "email"; //Required $emailTemplate = "emailTemplate"; //Optional $resetPasswordUrl = "resetPasswordUrl"; //Optional -$sendEmail = "true"; //Optional +$sendEmail = true; //Optional $result = $accountAPI->getForgotPasswordToken($email,$emailTemplate,$resetPasswordUrl,$sendEmail); ``` @@ -1091,6 +1117,43 @@ $email = "email"; //Required $result = $accountAPI->getEmailVerificationToken($email); ``` +
Multipurpose Email Token Generation API (POST)
+ + This API generate Email tokens and Email OTPs for Email verification, Add email, Forgot password, Delete user, Passwordless login, Forgot pin, One-touch login and Auto login. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/multipurpose-token-and-sms-otp-generation-api/multipurpose-email-token-generation/) + + + ```php + + $payload = '{ +"clientguid" : "", +"email" : "", +"name" : "", +"type" : "", +"uid" : "", +"userName" : "" +}'; //Required +$tokentype = "tokentype"; //Required + +$result = $accountAPI->multipurposeEmailTokenGeneration($payload,$tokentype); + ``` + + +
Multipurpose SMS OTP Generation API (POST)
+ + This API generates SMS OTP for Add phone, Phone Id verification, Forgot password, Forgot pin, One-touch login, smart login and Passwordless login. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/account/multipurpose-token-and-sms-otp-generation-api/multipurpose-sms-otp-generation/) + + + ```php + + $payload = '{ +"name" : "", +"phone" : "", +"uid" : "" +}'; //Required +$smsotptype = "smsotptype"; //Required + +$result = $accountAPI->multipurposeSMSOTPGeneration($payload,$smsotptype); + ```
Get Privacy Policy History By Uid (GET)
@@ -1254,6 +1317,18 @@ $fields = null; //Optional $result = $accountAPI->removeEmail($email,$uid,$fields); ``` +
Revoke All Refresh Token (DELETE)
+ + The Revoke All Refresh Access Token API is used to revoke all refresh tokens for a specific user. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/refresh-token/revoke-all-refresh-token/) + + + ```php + +$uid = "uid"; //Required + +$result = $accountAPI->revokeAllRefreshToken($uid); + ``` +
Delete User Profiles By Email (DELETE)
@@ -1310,7 +1385,7 @@ The Refresh Access Token API is used to refresh the provider access token after $access_Token = "access_Token"; //Required $expiresIn = 0; //Optional -$isWeb = "true"; //Optional +$isWeb = true; //Optional $result = $socialAPI->refreshAccessToken($access_Token,$expiresIn,$isWeb); ``` @@ -1604,9 +1679,10 @@ This API is used to validate the verification code sent to verify a user's phone $otp = "otp"; //Required $phone = "phone"; //Required $fields = null; //Optional -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $phoneAuthenticationAPI->phoneVerificationByOTP($otp,$phone,$fields,$smsTemplate); +$result = $phoneAuthenticationAPI->phoneVerificationByOTP($otp,$phone,$fields,$smsTemplate,$isVoiceOtp); ``` @@ -1619,9 +1695,10 @@ This API is used to consume the verification code sent to verify a user's phone $access_token = "access_token"; //Required $otp = "otp"; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $phoneAuthenticationAPI->phoneVerificationOTPByAccessToken($access_token,$otp,$smsTemplate); +$result = $phoneAuthenticationAPI->phoneVerificationOTPByAccessToken($access_token,$otp,$smsTemplate,$isVoiceOtp); ``` @@ -1634,9 +1711,10 @@ This API is used to update the login Phone Number of users $access_token = "access_token"; //Required $phone = "phone"; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $phoneAuthenticationAPI->updatePhoneNumber($access_token,$phone,$smsTemplate); +$result = $phoneAuthenticationAPI->updatePhoneNumber($access_token,$phone,$smsTemplate,$isVoiceOtp); ``` @@ -1667,9 +1745,10 @@ This API is used to send the OTP to reset the account password. ```php $phone = "phone"; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $phoneAuthenticationAPI->forgotPasswordByPhoneOTP($phone,$smsTemplate); +$result = $phoneAuthenticationAPI->forgotPasswordByPhoneOTP($phone,$smsTemplate,$isVoiceOtp); ``` @@ -1681,9 +1760,10 @@ This API is used to resend a verification OTP to verify a user's Phone Number. T ```php $phone = "phone"; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $phoneAuthenticationAPI->phoneResendVerificationOTP($phone,$smsTemplate); +$result = $phoneAuthenticationAPI->phoneResendVerificationOTP($phone,$smsTemplate,$isVoiceOtp); ``` @@ -1726,7 +1806,9 @@ $smsTemplate = "smsTemplate"; //Optional $verificationUrl = "verificationUrl"; //Optional $welcomeEmailTemplate = "welcomeEmailTemplate"; //Optional $emailTemplate = "emailTemplate"; //Optional -$result = $phoneAuthenticationAPI->userRegistrationByPhone($payload,$sott,$fields,$options,$smsTemplate,$verificationUrl,$welcomeEmailTemplate,$emailTemplate); +$isVoiceOtp = false; //Optional + +$result = $phoneAuthenticationAPI->userRegistrationByPhone($payload,$sott,$fields,$options,$smsTemplate,$verificationUrl,$welcomeEmailTemplate,$emailTemplate,$isVoiceOtp); ``` @@ -1763,16 +1845,16 @@ $result = $phoneAuthenticationAPI->removePhoneIDByAccessToken($access_token); List of APIs in this Section:
[PUT : Update MFA Setting](#MFAUpdateSetting-put-)
-[PUT : Update MFA by Access Token](#MFAUpdateByAccessToken-put-)
[PUT : MFA Update Phone Number by Token](#MFAUpdatePhoneNumberByToken-put-)
[PUT : Verify MFA Email OTP by Access Token](#MFAValidateEmailOtpByAccessToken-put-)
[PUT : Update MFA Security Question by Access Token](#MFASecurityQuestionAnswerByAccessToken-put-)
[PUT : MFA Validate OTP](#MFAValidateOTPByPhone-put-)
-[PUT : MFA Validate Google Auth Code](#MFAValidateGoogleAuthCode-put-)
[PUT : MFA Validate Backup code](#MFAValidateBackupCode-put-)
[PUT : MFA Update Phone Number](#MFAUpdatePhoneNumber-put-)
[PUT : Verify MFA Email OTP by MFA Token](#MFAValidateEmailOtp-put-)
[PUT : Update MFA Security Question by MFA Token](#MFASecurityQuestionAnswer-put-)
+[PUT : MFA Validate Authenticator Code](#MFAValidateAuthenticatorCode-put-)
+[PUT : MFA Verify Authenticator Code](#MFAVerifyAuthenticatorCode-put-)
[POST : MFA Email Login](#MFALoginByEmail-post-)
[POST : MFA UserName Login](#MFALoginByUserName-post-)
[POST : MFA Phone Login](#MFALoginByPhone-post-)
@@ -1785,12 +1867,12 @@ List of APIs in this Section:
[GET : MFA Resend Otp](#MFAResendOTP-get-)
[GET : MFA Backup Code by UID](#MFABackupCodeByUid-get-)
[GET : MFA Reset Backup Code by UID](#MFAResetBackupCodeByUid-get-)
-[DELETE : MFA Reset Google Authenticator by Token](#MFAResetGoogleAuthByToken-delete-)
+[DELETE : MFA Reset Authenticator by Token](#MFAResetAuthenticatorByToken-delete-)
[DELETE : MFA Reset SMS Authenticator by Token](#MFAResetSMSAuthByToken-delete-)
[DELETE : Reset MFA Email OTP Authenticator By Access Token](#MFAResetEmailOtpAuthenticatorByAccessToken-delete-)
[DELETE : MFA Reset Security Question Authenticator By Access Token](#MFAResetSecurityQuestionAuthenticatorByAccessToken-delete-)
[DELETE : MFA Reset SMS Authenticator By UID](#MFAResetSMSAuthenticatorByUid-delete-)
-[DELETE : MFA Reset Google Authenticator By UID](#MFAResetGoogleAuthenticatorByUid-delete-)
+[DELETE : MFA Reset Authenticator By UID](#MFAResetAuthenticatorByUid-delete-)
[DELETE : Reset MFA Email OTP Authenticator Settings by Uid](#MFAResetEmailOtpAuthenticatorByUid-delete-)
[DELETE : Reset MFA Security Question Authenticator Settings by Uid](#MFAResetSecurityQuestionAuthenticatorByUid-delete-)
@@ -1817,24 +1899,6 @@ $result = $multiFactorAuthenticationAPI->mfaUpdateSetting($access_token,$payload ``` -
Update MFA by Access Token (PUT)
- -This API is used to Enable Multi-factor authentication by access token on user login - [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/google-authenticator/update-mfa-by-access-token/) - - ```php - -$access_token = "access_token"; //Required - $payload = '{ -"googleAuthenticatorCode" : "" -}'; //Required -$fields = null; //Optional -$smsTemplate = "smsTemplate"; //Optional - -$result = $multiFactorAuthenticationAPI->mfaUpdateByAccessToken($access_token,$payload,$fields,$smsTemplate); - ``` - -
MFA Update Phone Number by Token (PUT)
This API is used to update the Multi-factor authentication phone number by sending the verification OTP to the provided phone number @@ -1844,9 +1908,11 @@ This API is used to update the Multi-factor authentication phone number by sendi $access_token = "access_token"; //Required $phoneNo2FA = "phoneNo2FA"; //Required -$smsTemplate2FA = "smsTemplate2FA"; //Optional - -$result = $multiFactorAuthenticationAPI->mfaUpdatePhoneNumberByToken($access_token,$phoneNo2FA,$smsTemplate2FA); +$smsTemplate2FA = "smsTemplate2FA"; //Optional +$isVoiceOtp = false; //Optional +$options = "options"; //Optional + +$result = $multiFactorAuthenticationAPI->mfaUpdatePhoneNumberByToken($access_token,$phoneNo2FA,$smsTemplate2FA,$isVoiceOtp,$options); ``` @@ -1910,24 +1976,6 @@ $rbaIpEmailTemplate = "rbaIpEmailTemplate"; //Optional $result = $multiFactorAuthenticationAPI->mfaValidateOTPByPhone($payload,$secondFactorAuthenticationToken,$fields,$smsTemplate2FA,$rbaBrowserEmailTemplate,$rbaCityEmailTemplate,$rbaCountryEmailTemplate,$rbaIpEmailTemplate); ``` - -
MFA Validate Google Auth Code (PUT)
- -This API is used to login via Multi-factor-authentication by passing the google authenticator code. - [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/google-authenticator/mfa-validate-google-auth-code/) - - ```php - -$googleAuthenticatorCode = "googleAuthenticatorCode"; //Required -$secondFactorAuthenticationToken = "secondFactorAuthenticationToken"; //Required -$fields = null; //Optional -$rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional -$rbaCityEmailTemplate = "rbaCityEmailTemplate"; //Optional -$rbaCountryEmailTemplate = "rbaCountryEmailTemplate"; //Optional -$rbaIpEmailTemplate = "rbaIpEmailTemplate"; //Optional - -$result = $multiFactorAuthenticationAPI->mfaValidateGoogleAuthCode($googleAuthenticatorCode,$secondFactorAuthenticationToken,$fields,$rbaBrowserEmailTemplate,$rbaCityEmailTemplate,$rbaCountryEmailTemplate,$rbaIpEmailTemplate); - ```
MFA Validate Backup code (PUT)
@@ -1960,9 +2008,12 @@ This API is used to update (if configured) the phone number used for Multi-facto $phoneNo2FA = "phoneNo2FA"; //Required $secondFactorAuthenticationToken = "secondFactorAuthenticationToken"; //Required -$smsTemplate2FA = "smsTemplate2FA"; //Optional +$smsTemplate2FA = "smsTemplate2FA"; //Optional +$isVoiceOtp = false; //Optional +$options = "options"; //Optional + -$result = $multiFactorAuthenticationAPI->mfaUpdatePhoneNumber($phoneNo2FA,$secondFactorAuthenticationToken,$smsTemplate2FA); +$result = $multiFactorAuthenticationAPI->mfaUpdatePhoneNumber($phoneNo2FA,$secondFactorAuthenticationToken,$smsTemplate2FA,$isVoiceOtp,$options); ``` @@ -2008,6 +2059,38 @@ $secondFactorAuthenticationToken = "secondFactorAuthenticationToken"; //Required $result = $multiFactorAuthenticationAPI->mfaSecurityQuestionAnswer($payload,$secondFactorAuthenticationToken); ``` +
MFA Validate Authenticator Code (PUT)
+ + + This API is used to login to a user's account during the second MFA step with an Authenticator Code. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/authenticator/mfa-validate-authenticator-code/) + + + ```php + +$payload = '{ +"authenticatorCode" : "" +}'; //Required +$secondfactorauthenticationtoken = "secondfactorauthenticationtoken"; //Required +$fields = null; //Optional + +$result = $multiFactorAuthenticationAPI->mfaValidateAuthenticatorCode($payload,$secondfactorauthenticationtoken,$fields); + ``` + +
MFA Verify Authenticator Code (PUT)
+ + This API is used to validate an Authenticator Code as part of the MFA process. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/authenticator/mfa-verify-authenticator-code/) + + + ```php + +$access_token = "access_token"; //Required + $payload = '{ +"authenticatorCode" : "" +}'; //Required +$fields = null; //Optional + +$result = $multiFactorAuthenticationAPI->mfaVerifyAuthenticatorCode($access_token,$payload,$fields); + ```
MFA Email Login (POST)
@@ -2023,10 +2106,12 @@ $fields = null; //Optional $loginUrl = "loginUrl"; //Optional $smsTemplate = "smsTemplate"; //Optional $smsTemplate2FA = "smsTemplate2FA"; //Optional -$verificationUrl = "verificationUrl"; //Optional +$verificationUrl = "verificationUrl"; //Optional $emailTemplate2FA = "emailTemplate2FA"; //Optional - -$result = $multiFactorAuthenticationAPI->mfaLoginByEmail($email,$password,$emailTemplate,$fields,$loginUrl,$smsTemplate,$smsTemplate2FA,$verificationUrl,$emailTemplate2FA); +$isVoiceOtp = false; //Optional +$options = "options"; //Optional + +$result = $multiFactorAuthenticationAPI->mfaLoginByEmail($email,$password,$emailTemplate,$fields,$loginUrl,$smsTemplate,$smsTemplate2FA,$verificationUrl,$emailTemplate2FA,$isVoiceOtp,$options); ``` @@ -2044,10 +2129,11 @@ $fields = null; //Optional $loginUrl = "loginUrl"; //Optional $smsTemplate = "smsTemplate"; //Optional $smsTemplate2FA = "smsTemplate2FA"; //Optional -$verificationUrl = "verificationUrl"; //Optional +$verificationUrl = "verificationUrl"; //Optional $emailTemplate2FA = "emailTemplate2FA"; //Optional - -$result = $multiFactorAuthenticationAPI->mfaLoginByUserName($password,$username,$emailTemplate,$fields,$loginUrl,$smsTemplate,$smsTemplate2FA,$verificationUrl,$emailTemplate2FA); +$isVoiceOtp = false; //Optional + +$result = $multiFactorAuthenticationAPI->mfaLoginByUserName($password,$username,$emailTemplate,$fields,$loginUrl,$smsTemplate,$smsTemplate2FA,$verificationUrl,$emailTemplate2FA,$isVoiceOtp); ``` @@ -2065,10 +2151,12 @@ $fields = null; //Optional $loginUrl = "loginUrl"; //Optional $smsTemplate = "smsTemplate"; //Optional $smsTemplate2FA = "smsTemplate2FA"; //Optional -$verificationUrl = "verificationUrl"; //Optional +$verificationUrl = "verificationUrl"; //Optional $emailTemplate2FA = "emailTemplate2FA"; //Optional - -$result = $multiFactorAuthenticationAPI->mfaLoginByPhone($password,$phone,$emailTemplate,$fields,$loginUrl,$smsTemplate,$smsTemplate2FA,$verificationUrl,$emailTemplate2FA); +$isVoiceOtp = false; //Optional +$options = "options"; //Optional + +$result = $multiFactorAuthenticationAPI->mfaLoginByPhone($password,$phone,$emailTemplate,$fields,$loginUrl,$smsTemplate,$smsTemplate2FA,$verificationUrl,$emailTemplate2FA,$isVoiceOtp,$options); ``` @@ -2122,9 +2210,9 @@ This API is used to configure the Multi-factor authentication after login by usi ```php $access_token = "access_token"; //Required -$smsTemplate2FA = "smsTemplate2FA"; //Optional +$isVoiceOtp = false; //Optional -$result = $multiFactorAuthenticationAPI->mfaConfigureByAccessToken($access_token,$smsTemplate2FA); +$result = $multiFactorAuthenticationAPI->mfaConfigureByAccessToken($access_token,$isVoiceOtp); ``` @@ -2177,9 +2265,10 @@ This API is used to resending the verification OTP to the provided phone number ```php $secondFactorAuthenticationToken = "secondFactorAuthenticationToken"; //Required -$smsTemplate2FA = "smsTemplate2FA"; //Optional +$smsTemplate2FA = "smsTemplate2FA"; //Optional +$isVoiceOtp = false; //Optional -$result = $multiFactorAuthenticationAPI->mfaResendOTP($secondFactorAuthenticationToken,$smsTemplate2FA); +$result = $multiFactorAuthenticationAPI->mfaResendOTP($secondFactorAuthenticationToken,$smsTemplate2FA,$isVoiceOtp); ``` @@ -2208,18 +2297,16 @@ $uid = "uid"; //Required $result = $multiFactorAuthenticationAPI->mfaResetBackupCodeByUid($uid); ``` - -
MFA Reset Google Authenticator by Token (DELETE)
+
MFA Reset 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 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/authenticator/mfa-reset-authenticator-by-token/) ```php $access_token = "access_token"; //Required -$googleauthenticator = "true"; //Required +$authenticator = true; //Required -$result = $multiFactorAuthenticationAPI->mfaResetGoogleAuthByToken($access_token,$googleauthenticator); +$result = $multiFactorAuthenticationAPI->mfaResetAuthenticatorByToken($access_token,$authenticator); ``` @@ -2231,7 +2318,7 @@ This API resets the SMS Authenticator configurations on a given account via the ```php $access_token = "access_token"; //Required -$otpauthenticator = "true"; //Required +$otpauthenticator = true; //Required $result = $multiFactorAuthenticationAPI->mfaResetSMSAuthByToken($access_token,$otpauthenticator); ``` @@ -2270,26 +2357,26 @@ This API resets the SMS Authenticator configurations on a given account via the ```php -$otpauthenticator = "true"; //Required +$otpauthenticator = true; //Required $uid = "uid"; //Required $result = $multiFactorAuthenticationAPI->mfaResetSMSAuthenticatorByUid($otpauthenticator,$uid); ``` - -
MFA Reset Google Authenticator By UID (DELETE)
-This API resets the Google Authenticator configurations on a given account via the UID. - [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/google-authenticator/mfa-reset-google-authenticator-by-uid/) +
MFA Reset Authenticator By UID (DELETE)
+ + This API resets the Authenticator configurations on a given account via the UID. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/authenticator/mfa-reset-authenticator-by-uid/) ```php -$googleauthenticator = "true"; //Required +$authenticator = true; //Required $uid = "uid"; //Required -$result = $multiFactorAuthenticationAPI->mfaResetGoogleAuthenticatorByUid($googleauthenticator,$uid); +$result = $multiFactorAuthenticationAPI->mfaResetAuthenticatorByUid($authenticator,$uid); ``` +
Reset MFA Email OTP Authenticator Settings by Uid (DELETE)
@@ -2535,9 +2622,10 @@ This API sends the OTP to specified phone number $payload = '{ "phone" : "" }'; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $pinAuthenticationAPI->sendForgotPINSMSByPhone($payload,$smsTemplate); +$result = $pinAuthenticationAPI->sendForgotPINSMSByPhone($payload,$smsTemplate,$isVoiceOtp); ``` @@ -2578,10 +2666,10 @@ $result = $pinAuthenticationAPI->inValidatePinSessionToken($session_token); List of APIs in this Section:
[PUT : Validate MFA by OTP](#MFAReAuthenticateByOTP-put-)
[PUT : Validate MFA by Backup Code](#MFAReAuthenticateByBackupCode-put-)
-[PUT : Validate MFA by Google Authenticator Code](#MFAReAuthenticateByGoogleAuth-put-)
[PUT : Validate MFA by Password](#MFAReAuthenticateByPassword-put-)
[PUT : MFA Re-authentication by PIN](#VerifyPINAuthentication-put-)
[PUT : MFA Re-authentication by Email OTP](#ReAuthValidateEmailOtp-put-)
+[PUT : MFA Step-Up Authentication by Authenticator Code](#MFAReAuthenticateByAuthenticatorCode-put-)
[POST : Verify Multifactor OTP Authentication](#VerifyMultiFactorOtpReauthentication-post-)
[POST : Verify Multifactor Password Authentication](#VerifyMultiFactorPasswordReauthentication-post-)
[POST : Verify Multifactor PIN Authentication](#VerifyMultiFactorPINReauthentication-post-)
@@ -2626,21 +2714,6 @@ $access_token = "access_token"; //Required $result = $reAuthenticationAPI->mfaReAuthenticateByBackupCode($access_token,$payload); ``` - -
Validate MFA by Google Authenticator Code (PUT)
- -This API is used to re-authenticate via Multi-factor-authentication by passing the google authenticator code - [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/multi-factor-authentication/re-authentication/re-auth-by-google-authenticator-code) - - ```php - -$access_token = "access_token"; //Required - $payload = '{ -"googleAuthenticatorCode" : "" -}'; //Required - -$result = $reAuthenticationAPI->mfaReAuthenticateByGoogleAuth($access_token,$payload); - ```
Validate MFA by Password (PUT)
@@ -2693,6 +2766,21 @@ $access_token = "access_token"; //Required $result = $reAuthenticationAPI->reAuthValidateEmailOtp($access_token,$payload); ``` +
MFA Step-Up Authentication by Authenticator Code (PUT)
+ + This API is used to validate the triggered MFA authentication flow with the Authenticator Code. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/re-authentication/mfa/re-auth-by-otp/) + + + ```php + +$access_token = "access_token"; //Required +$payload = '{ + "authenticatorCode" : "" +}'; //Required + +$result = $reAuthenticationAPI->mfaReAuthenticateByAuthenticatorCode($access_token,$payload); + ``` +
Verify Multifactor OTP Authentication (POST)
@@ -2771,9 +2859,10 @@ This API is used to trigger the Multi-Factor Autentication workflow for the prov ```php $access_token = "access_token"; //Required -$smsTemplate2FA = "smsTemplate2FA"; //Optional +$smsTemplate2FA = "smsTemplate2FA"; //Optional +$isVoiceOtp = false; //Optional -$result = $reAuthenticationAPI->mfaReAuthenticate($access_token,$smsTemplate2FA); +$result = $reAuthenticationAPI->mfaReAuthenticate($access_token,$smsTemplate2FA,$isVoiceOtp); ``` @@ -2911,7 +3000,7 @@ This API is used to check if consent is submitted for a particular event or not. $access_token = "access_token"; //Required $event = "event"; //Required -$isCustom = "true"; //Required +$isCustom = true; //Required $result = $consentManagementAPI->verifyConsentByAccessToken($access_token,$event,$isCustom); ``` @@ -3061,9 +3150,10 @@ This API is used to send one time password to a given phone number for a frictio "g-recaptcha-response" : "", "phone" : "" }'; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $oneTouchLoginAPI->oneTouchLoginByPhone($payload,$smsTemplate); +$result = $oneTouchLoginAPI->oneTouchLoginByPhone($payload,$smsTemplate,$isVoiceOtp); ``` @@ -3127,9 +3217,10 @@ This API verifies an account by OTP and allows the customer to login. "phone" : "" }'; //Required $fields = null; //Optional -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $passwordLessLoginAPI->passwordlessLoginPhoneVerification($payload,$fields,$smsTemplate); +$result = $passwordLessLoginAPI->passwordlessLoginPhoneVerification($payload,$fields,$smsTemplate,$isVoiceOtp); ``` @@ -3179,9 +3270,10 @@ API can be used to send a One-time Passcode (OTP) provided that the account has ```php $phone = "phone"; //Required -$smsTemplate = "smsTemplate"; //Optional +$smsTemplate = "smsTemplate"; //Optional +$isVoiceOtp = false; //Optional -$result = $passwordLessLoginAPI->passwordlessLoginByPhone($phone,$smsTemplate); +$result = $passwordLessLoginAPI->passwordlessLoginByPhone($phone,$smsTemplate,$isVoiceOtp); ``` @@ -3533,7 +3625,7 @@ This API retrieves a copy of the user data based on the Email $emailTemplate = "emailTemplate"; //Optional $fields = null; //Optional $loginUrl = "loginUrl"; //Optional -$passwordDelegation = "true"; //Optional +$passwordDelegation = true; //Optional $passwordDelegationApp = "passwordDelegationApp"; //Optional $rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional $rbaBrowserSmsTemplate = "rbaBrowserSmsTemplate"; //Optional @@ -3566,7 +3658,7 @@ This API retrieves a copy of the user data based on the Username $emailTemplate = "emailTemplate"; //Optional $fields = null; //Optional $loginUrl = "loginUrl"; //Optional -$passwordDelegation = "true"; //Optional +$passwordDelegation = true; //Optional $passwordDelegationApp = "passwordDelegationApp"; //Optional $rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional $rbaBrowserSmsTemplate = "rbaBrowserSmsTemplate"; //Optional @@ -3599,7 +3691,7 @@ This API retrieves a copy of the user data based on the Phone $emailTemplate = "emailTemplate"; //Optional $fields = null; //Optional $loginUrl = "loginUrl"; //Optional -$passwordDelegation = "true"; //Optional +$passwordDelegation = true; //Optional $passwordDelegationApp = "passwordDelegationApp"; //Optional $rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional $rbaBrowserSmsTemplate = "rbaBrowserSmsTemplate"; //Optional @@ -3651,6 +3743,7 @@ $result = $sottAPI->generateSott($timeDifference); ### NativeSocial API List of APIs in this Section:
+[GET : Get Access Token via Custom JWT Token](#AccessTokenViaCustomJWTToken-get-)
[GET : Access Token via Facebook Token](#GetAccessTokenByFacebookAccessToken-get-)
[GET : Access Token via Twitter Token](#GetAccessTokenByTwitterAccessToken-get-)
[GET : Access Token via Google Token](#GetAccessTokenByGoogleAccessToken-get-)
@@ -3666,6 +3759,18 @@ If you have not already initialized the NativeSocial object do so now $nativeSocialAPI = new NativeSocialAPI(); ``` +
Get Access Token via Custom JWT Token (GET)
+ + This API is used to retrieve a LoginRadius access token by passing in a valid custom JWT token. [More info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-by-custom-jwt-token/) + + + ```php + +$id_Token = "id_Token"; //Required +$providername = "providername"; //Required + +$result = $nativeSocialAPI->accessTokenViaCustomJWTToken($id_Token,$providername); + ```
Access Token via Facebook Token (GET)
@@ -3866,6 +3971,33 @@ API can be used to unsubscribe a WebHook configured on your LoginRadius site. $result = $webHookAPI->webHookUnsubscribe($payload); ``` + +### SlidingToken API + + +List of APIs in this Section:
+[GET : Get Sliding Access Token](#SlidingAccessToken-get-)
+ + +If you have not already initialized the SlidingToken object do so now +```php +$slidingTokenAPI = new SlidingTokenAPI(); +``` + + +
(GET)
+ + This API is used to get access token and refresh token with the expired/nonexpired access token. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/refresh-token/sliding-access-token) + + + +```php + +$access_token = "access_token"; //Required + +$result = $slidingTokenAPI->slidingAccessToken($access_token); + +``` ### Generate SOTT Manually SOTT is a secure one-time token that can be created using the API key, API secret, and a timestamp ( start time and end time ). You can manually create a SOTT using the following utility function. diff --git a/composer.json b/composer.json index ee26078..b6b9544 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "loginradius/php-sdk", - "description": "LoginRadius PHP SDK v11.5.0", + "description": "LoginRadius PHP SDK v11.6.0", "keywords": ["loginradius", "phpsdk"], "type": "library", "license": "MIT", diff --git a/demo/ajax_handler/login.php b/demo/ajax_handler/login.php index dd5c5c0..57da7d1 100644 --- a/demo/ajax_handler/login.php +++ b/demo/ajax_handler/login.php @@ -255,14 +255,11 @@ function mfaValidate(array $request) } else { $authenticationObj = new MultiFactorAuthenticationAPI(); $fields = ''; - $rbaBrowserEmailTemplate = ''; - $rbaCityEmailTemplate = ''; - $rbaCountryEmailTemplate = ''; - $rbaIpEmailTemplate = ''; - $result = $authenticationObj->mFAValidateGoogleAuthCode($googleAuthCode, $secondFactorAuthenticationToken, $fields, $rbaBrowserEmailTemplate, $rbaCityEmailTemplate, $rbaCountryEmailTemplate, $rbaIpEmailTemplate); + $payload = array('authenticatorCode' => $googleAuthCode); + $result = $authenticationObj->mfaValidateAuthenticatorCode($payload,$secondFactorAuthenticationToken,$fields); if ((isset($result->access_token) && $result->access_token != '')) { $response['data'] = $result; - $response['message'] = "Google Auth Code successfully validated."; + $response['message'] = "Auth Code successfully validated."; $response['status'] = 'success'; }else if (isset($result->error_response)) { $response['message'] = $result->error_response->Description; diff --git a/demo/ajax_handler/profile.php b/demo/ajax_handler/profile.php index 1d79328..9fdc337 100644 --- a/demo/ajax_handler/profile.php +++ b/demo/ajax_handler/profile.php @@ -318,7 +318,7 @@ function resetMultifactor(array $request) $authObj = new MultiFactorAuthenticationAPI(); $response = array('status' => 'error', 'message' => 'An error occurred.'); - $result = $authObj->mFAResetGoogleAuthByToken($request['token'], true); + $result = $authObj->mfaResetAuthenticatorByToken($request['token'], true); if (isset($result->IsDeleted) && $result->IsDeleted) { $response['message'] = "Reset successfully."; $response['status'] = 'success'; diff --git a/demo/js/indexControl.js b/demo/js/indexControl.js index 7205a0c..6f21534 100644 --- a/demo/js/indexControl.js +++ b/demo/js/indexControl.js @@ -87,7 +87,7 @@ $("#btn-minimal-mfalogin-next").click(function() { } $("#minimal-mfalogin-next") .html('' + - '' + + '' + '
Google Authenticator Code: Authenticator Code:
' + ''); multiFactorAuthToken = ret.data.SecondFactorAuthentication.SecondFactorAuthenticationToken; diff --git a/demo/profile.html b/demo/profile.html index 072df61..bf369d1 100644 --- a/demo/profile.html +++ b/demo/profile.html @@ -132,7 +132,7 @@

Custom Object Management

Configure MultiFactor

- Reset Google Authenticator
+ Reset Authenticator


diff --git a/src/LoginRadiusSDK/CustomerRegistration/Account/AccountAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Account/AccountAPI.php index 44fc528..ce34c82 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Account/AccountAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Account/AccountAPI.php @@ -379,11 +379,13 @@ public function getAccessTokenByUid($uid) * This API Allows you to reset the phone no verification of an end user’s account. * @param uid UID, the unified identifier for each user account * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Validation data * 18.27 */ - public function resetPhoneIDVerificationByUid($uid, $smsTemplate = "") + public function resetPhoneIDVerificationByUid($uid, $smsTemplate = "", + $isVoiceOtp = false) { $resourcePath = "/identity/v2/manage/account/$uid/invalidatephone"; $queryParam = []; @@ -392,6 +394,9 @@ public function resetPhoneIDVerificationByUid($uid, $smsTemplate = "") if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam); } @@ -491,6 +496,43 @@ public function revokeRefreshToken($refreshToken) + /** + * The Revoke All Refresh Access Token API is used to revoke all refresh tokens for a specific user. + * @param uid UID, the unified identifier for each user account + * @return Response containing Definition of Delete Request + * 18.33 + */ + + public function revokeAllRefreshToken($uid) + { + $resourcePath = "/identity/v2/manage/account/$uid/access_token/refresh/revoke"; + $queryParam = []; + $queryParam['apiKey'] = Functions::getApiKey(); + $queryParam['apiSecret'] = Functions::getApiSecret(); + return Functions::_apiClientHandler('DELETE', $resourcePath, $queryParam); + } + + + + /** + * This API generate Email tokens and Email OTPs for Email verification, Add email, Forgot password, Delete user, Passwordless login, Forgot pin, One-touch login and Auto login. + * @param multiEmailToken Model Class containing Definition of payload for Multipurpose Email Token Generation API + * @param tokentype The identifier type for the token that we need to generate + * @return Response containing Definition for Complete MultiToken + * 18.34 + */ + + public function multipurposeEmailTokenGeneration($multiEmailToken, $tokentype) + { + $resourcePath = "/identity/v2/manage/account/emailtoken/$tokentype"; + $queryParam = []; + $queryParam['apiKey'] = Functions::getApiKey(); + $queryParam['apiSecret'] = Functions::getApiSecret(); + return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $multiEmailToken); + } + + + /** * Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage. * @param email Email of the user @@ -539,6 +581,23 @@ public function accountDeleteByEmail($email) + /** + * This API generates SMS OTP for Add phone, Phone Id verification, Forgot password, Forgot pin, One-touch login, smart login and Passwordless login. + * @param multiSmsOtp + * @param smsotptype The identifier type for the OTP that we need to generate + * @return Response containing Definition for Complete MultiToken + * 18.44 + */ + + public function multipurposeSMSOTPGeneration($multiSmsOtp, $smsotptype) + { + $resourcePath = "/identity/v2/manage/account/smsotp/$smsotptype"; + $queryParam = []; + $queryParam['apiKey'] = Functions::getApiKey(); + $queryParam['apiSecret'] = Functions::getApiSecret(); + return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $multiSmsOtp); + } + /** * 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. * @param updateUidModel Payload containing Update UID diff --git a/src/LoginRadiusSDK/CustomerRegistration/Advanced/MultiFactorAuthenticationAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Advanced/MultiFactorAuthenticationAPI.php index 4535f24..62d483e 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Advanced/MultiFactorAuthenticationAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Advanced/MultiFactorAuthenticationAPI.php @@ -25,12 +25,12 @@ public function __construct($options = []) /** * 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. * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param smsTemplate2FA SMS Template Name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Multi-Factor Authentication Settings data * 5.7 */ - public function mfaConfigureByAccessToken($accessToken, $smsTemplate2FA = null) + public function mfaConfigureByAccessToken($accessToken, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/account/2fa"; $queryParam = []; @@ -38,8 +38,8 @@ public function mfaConfigureByAccessToken($accessToken, $smsTemplate2FA = null) throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); } $queryParam['apiKey'] = Functions::getApiKey(); - if ($smsTemplate2FA != '') { - $queryParam['smsTemplate2FA'] = $smsTemplate2FA; + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; } $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('GET', $resourcePath, $queryParam); @@ -74,48 +74,19 @@ public function mfaUpdateSetting($accessToken, $multiFactorAuthModelWithLockout, - /** - * This API is used to Enable Multi-factor authentication by access token on user login - * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param multiFactorAuthModelByGoogleAuthenticatorCode Model Class containing Definition of payload for MultiFactorAuthModel By GoogleAuthenticator Code API - * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields - * @param smsTemplate SMS Template name - * @return Response containing Definition for Complete profile data - * 5.10 - */ - - public function mfaUpdateByAccessToken($accessToken, $multiFactorAuthModelByGoogleAuthenticatorCode, - $fields = "", $smsTemplate = null) - { - $resourcePath = "/identity/v2/auth/account/2fa/verification/googleauthenticatorcode"; - $queryParam = []; - if ($accessToken === '' || ctype_space($accessToken)) { - throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); - } - $queryParam['apiKey'] = Functions::getApiKey(); - if ($fields != '') { - $queryParam['fields'] = $fields; - } - if ($smsTemplate != '') { - $queryParam['smsTemplate'] = $smsTemplate; - } - $queryParam['access_token'] = $accessToken; - return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $multiFactorAuthModelByGoogleAuthenticatorCode); - } - - - /** * This API is used to update the Multi-factor authentication phone number by sending the verification OTP to the provided phone number * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @param phoneNo2FA Phone Number For 2FA * @param smsTemplate2FA SMS Template Name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) * @return Response containing Definition for Complete SMS data * 5.11 */ public function mfaUpdatePhoneNumberByToken($accessToken, $phoneNo2FA, - $smsTemplate2FA = null) + $smsTemplate2FA = null, $isVoiceOtp = false, $options = "") { $resourcePath = "/identity/v2/auth/account/2fa"; $bodyParam = []; @@ -128,6 +99,12 @@ public function mfaUpdatePhoneNumberByToken($accessToken, $phoneNo2FA, if ($smsTemplate2FA != '') { $queryParam['smsTemplate2FA'] = $smsTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } + if ($options != '') { + $queryParam['options'] = $options; + } $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -135,18 +112,18 @@ public function mfaUpdatePhoneNumberByToken($accessToken, $phoneNo2FA, /** - * This API Resets the Google Authenticator configurations on a given account via the access token + * This API Resets the Authenticator configurations on a given account via the access_token. * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param googleauthenticator boolean type value,Enable google Authenticator Code. + * @param authenticator Pass true to remove Authenticator. * @return Response containing Definition of Delete Request * 5.12.1 */ - public function mfaResetGoogleAuthByToken($accessToken, $googleauthenticator) + public function mfaResetAuthenticatorByToken($accessToken, $authenticator) { $resourcePath = "/identity/v2/auth/account/2fa/authenticator"; $bodyParam = []; - $bodyParam['googleauthenticator'] = $googleauthenticator; + $bodyParam['authenticator'] = $authenticator; $queryParam = []; if ($accessToken === '' || ctype_space($accessToken)) { throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); @@ -352,14 +329,16 @@ public function mfaResetSecurityQuestionAuthenticatorByAccessToken($accessToken) * @param smsTemplate2FA SMS Template Name * @param verificationUrl Email verification url * @param emailTemplate2FA 2FA Email Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) * @return Complete user UserProfile data * 9.8.1 */ public function mfaLoginByEmail($email, $password, $emailTemplate = null, $fields = "", - $loginUrl = null, $smsTemplate = null, $smsTemplate2FA = null, - $verificationUrl = null, $emailTemplate2FA = null) + $loginUrl = null, $smsTemplate = null, $smsTemplate2FA = null, + $verificationUrl = null, $emailTemplate2FA = null, $isVoiceOtp = false, $options = "") { $resourcePath = "/identity/v2/auth/login/2fa"; $bodyParam = []; @@ -388,6 +367,12 @@ public function mfaLoginByEmail($email, $password, if ($emailTemplate2FA != '') { $queryParam['emailTemplate2FA'] = $emailTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } + if ($options != '') { + $queryParam['options'] = $options; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -404,6 +389,7 @@ public function mfaLoginByEmail($email, $password, * @param smsTemplate2FA SMS Template Name * @param verificationUrl Email verification url * @param emailTemplate2FA 2FA Email Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Complete user UserProfile data * 9.8.2 */ @@ -411,7 +397,7 @@ public function mfaLoginByEmail($email, $password, public function mfaLoginByUserName($password, $username, $emailTemplate = null, $fields = "",$loginUrl = null, $smsTemplate = null, $smsTemplate2FA = null, - $verificationUrl = null, $emailTemplate2FA = null) + $verificationUrl = null, $emailTemplate2FA = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/login/2fa"; $bodyParam = []; @@ -440,6 +426,9 @@ public function mfaLoginByUserName($password, $username, if ($emailTemplate2FA != '') { $queryParam['emailTemplate2FA'] = $emailTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -456,6 +445,8 @@ public function mfaLoginByUserName($password, $username, * @param smsTemplate2FA SMS Template Name * @param verificationUrl Email verification url * @param emailTemplate2FA 2FA Email Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) * @return Complete user UserProfile data * 9.8.3 */ @@ -463,7 +454,7 @@ public function mfaLoginByUserName($password, $username, public function mfaLoginByPhone($password, $phone, $emailTemplate = null, $fields = "", $loginUrl = null, $smsTemplate = null, $smsTemplate2FA = null, - $verificationUrl = null, $emailTemplate2FA = null) + $verificationUrl = null, $emailTemplate2FA = null, $isVoiceOtp = false, $options = "") { $resourcePath = "/identity/v2/auth/login/2fa"; $bodyParam = []; @@ -492,6 +483,12 @@ public function mfaLoginByPhone($password, $phone, if ($emailTemplate2FA != '') { $queryParam['emailTemplate2FA'] = $emailTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } + if ($options != '') { + $queryParam['options'] = $options; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -545,52 +542,6 @@ public function mfaValidateOTPByPhone($multiFactorAuthModelWithLockout, $secondF - /** - * This API is used to login via Multi-factor-authentication by passing the google authenticator code. - * @param googleAuthenticatorCode The code generated by google authenticator app after scanning QR code - * @param secondFactorAuthenticationToken SecondFactorAuthenticationToken - * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields - * @param rbaBrowserEmailTemplate RbaBrowserEmailTemplate - * @param rbaCityEmailTemplate RbaCityEmailTemplate - * @param rbaCountryEmailTemplate RbaCountryEmailTemplate - * @param rbaIpEmailTemplate RbaIpEmailTemplate - * @return Complete user UserProfile data - * 9.13 - */ - - public function mfaValidateGoogleAuthCode($googleAuthenticatorCode, $secondFactorAuthenticationToken, - $fields = "", $rbaBrowserEmailTemplate = null, $rbaCityEmailTemplate = null, - $rbaCountryEmailTemplate = null, $rbaIpEmailTemplate = null) - { - $resourcePath = "/identity/v2/auth/login/2fa/verification/googleauthenticatorcode"; - $bodyParam = []; - $bodyParam['googleAuthenticatorCode'] = $googleAuthenticatorCode; - $queryParam = []; - $queryParam['apiKey'] = Functions::getApiKey(); - if ($secondFactorAuthenticationToken === '' || ctype_space($secondFactorAuthenticationToken)) { - throw new LoginRadiusException(Functions::paramValidationMsg('secondFactorAuthenticationToken')); - } - if ($fields != '') { - $queryParam['fields'] = $fields; - } - if ($rbaBrowserEmailTemplate != '') { - $queryParam['rbaBrowserEmailTemplate'] = $rbaBrowserEmailTemplate; - } - if ($rbaCityEmailTemplate != '') { - $queryParam['rbaCityEmailTemplate'] = $rbaCityEmailTemplate; - } - if ($rbaCountryEmailTemplate != '') { - $queryParam['rbaCountryEmailTemplate'] = $rbaCountryEmailTemplate; - } - if ($rbaIpEmailTemplate != '') { - $queryParam['rbaIpEmailTemplate'] = $rbaIpEmailTemplate; - } - $queryParam['secondFactorAuthenticationToken'] = $secondFactorAuthenticationToken; - return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, json_encode($bodyParam)); - } - - - /** * 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 * @param multiFactorAuthModelByBackupCode Model Class containing Definition of payload for MultiFactorAuth By BackupCode API @@ -640,12 +591,14 @@ public function mfaValidateBackupCode($multiFactorAuthModelByBackupCode, $second * @param phoneNo2FA Phone Number For 2FA * @param secondFactorAuthenticationToken A Uniquely generated MFA identifier token after successful authentication * @param smsTemplate2FA SMS Template Name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) * @return Response containing Definition for Complete SMS data * 9.16 */ - public function mfaUpdatePhoneNumber($phoneNo2FA, $secondFactorAuthenticationToken, - $smsTemplate2FA = null) + public function mfaUpdatePhoneNumber($phoneNo2FA, $secondFactorAuthenticationToken, $smsTemplate2FA = null, + $isVoiceOtp = false , $options = "") { $resourcePath = "/identity/v2/auth/login/2fa"; $bodyParam = []; @@ -658,6 +611,12 @@ public function mfaUpdatePhoneNumber($phoneNo2FA, $secondFactorAuthenticationTok if ($smsTemplate2FA != '') { $queryParam['smsTemplate2FA'] = $smsTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } + if ($options != '') { + $queryParam['options'] = $options; + } $queryParam['secondFactorAuthenticationToken'] = $secondFactorAuthenticationToken; return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -668,11 +627,13 @@ public function mfaUpdatePhoneNumber($phoneNo2FA, $secondFactorAuthenticationTok * This API is used to resending the verification OTP to the provided phone number * @param secondFactorAuthenticationToken A Uniquely generated MFA identifier token after successful authentication * @param smsTemplate2FA SMS Template Name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition for Complete SMS data * 9.17 */ - public function mfaResendOTP($secondFactorAuthenticationToken, $smsTemplate2FA = null) + public function mfaResendOTP($secondFactorAuthenticationToken, $smsTemplate2FA = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/login/2fa/resend"; $queryParam = []; @@ -683,6 +644,9 @@ public function mfaResendOTP($secondFactorAuthenticationToken, $smsTemplate2FA = if ($smsTemplate2FA != '') { $queryParam['smsTemplate2FA'] = $smsTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['secondFactorAuthenticationToken'] = $secondFactorAuthenticationToken; return Functions::_apiClientHandler('GET', $resourcePath, $queryParam); } @@ -844,18 +808,18 @@ public function mfaResetSMSAuthenticatorByUid($otpauthenticator, $uid) /** - * This API resets the Google Authenticator configurations on a given account via the UID. - * @param googleauthenticator boolean type value,Enable google Authenticator Code. + * This API resets the Authenticator configurations on a given account via the UID. + * @param authenticator Pass true to remove Authenticator. * @param uid UID, the unified identifier for each user account * @return Response containing Definition of Delete Request * 18.21.2 */ - public function mfaResetGoogleAuthenticatorByUid($googleauthenticator, $uid) + public function mfaResetAuthenticatorByUid($authenticator, $uid) { $resourcePath = "/identity/v2/manage/account/2fa/authenticator"; $bodyParam = []; - $bodyParam['googleauthenticator'] = $googleauthenticator; + $bodyParam['authenticator'] = $authenticator; $queryParam = []; $queryParam['apiKey'] = Functions::getApiKey(); $queryParam['apiSecret'] = Functions::getApiSecret(); @@ -953,5 +917,59 @@ public function mfaResetSecurityQuestionAuthenticatorByUid($uid) $queryParam['uid'] = $uid; return Functions::_apiClientHandler('DELETE', $resourcePath, $queryParam); } + + + + /** + * This API is used to login to a user's account during the second MFA step with an Authenticator Code. + * @param multiFactorAuthModelByAuthenticatorCode Model Class containing Definition of payload for MultiFactorAuthModel By Authenticator Code API + * @param secondfactorauthenticationtoken A Uniquely generated MFA identifier token after successful authentication + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @return Complete user UserProfile data + * 44.7 + */ + + public function mfaValidateAuthenticatorCode($multiFactorAuthModelByAuthenticatorCode, $secondfactorauthenticationtoken, + $fields = "") + { + $resourcePath = "/identity/v2/auth/login/2fa/verification/authenticatorcode"; + $queryParam = []; + $queryParam['apiKey'] = Functions::getApiKey(); + if ($secondfactorauthenticationtoken === '' || ctype_space($secondfactorauthenticationtoken)) { + throw new LoginRadiusException(Functions::paramValidationMsg('secondfactorauthenticationtoken')); + } + if ($fields != '') { + $queryParam['fields'] = $fields; + } + $queryParam['secondfactorauthenticationtoken'] = $secondfactorauthenticationtoken; + return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $multiFactorAuthModelByAuthenticatorCode); + } + + + + /** + * This API is used to validate an Authenticator Code as part of the MFA process. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param multiFactorAuthModelByAuthenticatorCodeSecurityAnswer Model Class containing Definition of payload for MultiFactorAuthModel By Authenticator Code API with security answer + * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields + * @return Complete user UserProfile data + * 44.8 + */ + + public function mfaVerifyAuthenticatorCode($accessToken, $multiFactorAuthModelByAuthenticatorCodeSecurityAnswer, + $fields = "") + { + $resourcePath = "/identity/v2/auth/account/2fa/verification/authenticatorcode"; + $queryParam = []; + if ($accessToken === '' || ctype_space($accessToken)) { + throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); + } + $queryParam['apiKey'] = Functions::getApiKey(); + if ($fields != '') { + $queryParam['fields'] = $fields; + } + $queryParam['access_token'] = $accessToken; + return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $multiFactorAuthModelByAuthenticatorCodeSecurityAnswer); + } } \ No newline at end of file diff --git a/src/LoginRadiusSDK/CustomerRegistration/Advanced/ReAuthenticationAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Advanced/ReAuthenticationAPI.php index df6725b..03937e5 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Advanced/ReAuthenticationAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Advanced/ReAuthenticationAPI.php @@ -26,11 +26,13 @@ public function __construct($options = []) * This API is used to trigger the Multi-Factor Autentication workflow for the provided access token * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @param smsTemplate2FA SMS Template Name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Multi-Factor Authentication Settings data * 14.3 */ - public function mfaReAuthenticate($accessToken, $smsTemplate2FA = null) + public function mfaReAuthenticate($accessToken, $smsTemplate2FA = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/account/reauth/2fa"; $queryParam = []; @@ -41,6 +43,9 @@ public function mfaReAuthenticate($accessToken, $smsTemplate2FA = null) if ($smsTemplate2FA != '') { $queryParam['smsTemplate2FA'] = $smsTemplate2FA; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('GET', $resourcePath, $queryParam); } @@ -91,28 +96,6 @@ public function mfaReAuthenticateByBackupCode($accessToken, $reauthByBackupCodeM - /** - * This API is used to re-authenticate via Multi-factor-authentication by passing the google authenticator code - * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. - * @param reauthByGoogleAuthenticatorCodeModel Model Class containing Definition for MFA Reauthentication by Google Authenticator - * @return Complete user Multi-Factor Authentication Token data - * 14.6 - */ - - public function mfaReAuthenticateByGoogleAuth($accessToken, $reauthByGoogleAuthenticatorCodeModel) - { - $resourcePath = "/identity/v2/auth/account/reauth/2fa/googleauthenticatorcode"; - $queryParam = []; - if ($accessToken === '' || ctype_space($accessToken)) { - throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); - } - $queryParam['apiKey'] = Functions::getApiKey(); - $queryParam['access_token'] = $accessToken; - return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $reauthByGoogleAuthenticatorCodeModel); - } - - - /** * This API is used to re-authenticate via Multi-factor-authentication by passing the password * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. @@ -296,5 +279,27 @@ public function reAuthBySecurityQuestion($accessToken, $securityQuestionAnswerUp $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $securityQuestionAnswerUpdateModel); } + + + + /** + * This API is used to validate the triggered MFA authentication flow with the Authenticator Code. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param multiFactorAuthModelByAuthenticatorCode Model Class containing Definition of payload for MultiFactorAuthModel By Authenticator Code API + * @return Complete user Multi-Factor Authentication Token data + * 44.6 + */ + + public function mfaReAuthenticateByAuthenticatorCode($accessToken, $multiFactorAuthModelByAuthenticatorCode) + { + $resourcePath = "/identity/v2/auth/account/reauth/2fa/authenticatorcode"; + $queryParam = []; + if ($accessToken === '' || ctype_space($accessToken)) { + throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); + } + $queryParam['apiKey'] = Functions::getApiKey(); + $queryParam['access_token'] = $accessToken; + return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $multiFactorAuthModelByAuthenticatorCode); + } } \ No newline at end of file diff --git a/src/LoginRadiusSDK/CustomerRegistration/Authentication/AuthenticationAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Authentication/AuthenticationAPI.php index 0dd82f1..0a6ca98 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Authentication/AuthenticationAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Authentication/AuthenticationAPI.php @@ -245,13 +245,16 @@ public function sendWelcomeEmail($accessToken, $welcomeEmailTemplate = null) * @param nullSupport Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details * @param smsTemplate SMS Template name * @param verificationUrl Email verification url + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP + * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) * @return Response containing Definition of Complete Validation and UserProfile data * 5.4 */ public function updateProfileByAccessToken($accessToken, $userProfileUpdateModel, $emailTemplate = null, $fields = "", $nullSupport = false, - $smsTemplate = null, $verificationUrl = null) + $smsTemplate = null, $verificationUrl = null, + $isVoiceOtp = false, $options = "") { $resourcePath = "/identity/v2/auth/account"; $queryParam = []; @@ -274,6 +277,12 @@ public function updateProfileByAccessToken($accessToken, $userProfileUpdateModel if ($verificationUrl != '') { $queryParam['verificationUrl'] = $verificationUrl; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } + if ($options != '') { + $queryParam['options'] = $options; + } $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $userProfileUpdateModel); } @@ -418,12 +427,13 @@ public function checkEmailAvailability($email) * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @param url Mention URL to log the main URL(Domain name) in Database. * @param welcomeEmailTemplate Name of the welcome email template + * @param uuid The uuid received in the response * @return Response containing Definition of Complete Validation, UserProfile data and Access Token * 8.2 */ public function verifyEmail($verificationToken, $fields = "", - $url = null, $welcomeEmailTemplate = null) + $url = null, $welcomeEmailTemplate = null, $uuid = null) { $resourcePath = "/identity/v2/auth/email"; $queryParam = []; @@ -440,6 +450,9 @@ public function verifyEmail($verificationToken, $fields = "", if ($welcomeEmailTemplate != '') { $queryParam['welcomeEmailTemplate'] = $welcomeEmailTemplate; } + if ($uuid != '') { + $queryParam['uuid'] = $uuid; + } $queryParam['verificationToken'] = $verificationToken; return Functions::_apiClientHandler('GET', $resourcePath, $queryParam); } @@ -936,13 +949,14 @@ public function getPrivacyPolicyHistoryByAccessToken($accessToken) * @param options PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow) * @param verificationUrl Email verification url * @param welcomeEmailTemplate Name of the welcome email template + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Validation, UserProfile data and Access Token * 17.1.1 */ public function userRegistrationByEmail($authUserRegistrationModel, $sott, $emailTemplate = null, $fields = "", $options = "", - $verificationUrl = null, $welcomeEmailTemplate = null) + $verificationUrl = null, $welcomeEmailTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/register"; $queryParam = []; @@ -965,6 +979,9 @@ public function userRegistrationByEmail($authUserRegistrationModel, $sott, if ($welcomeEmailTemplate != '') { $queryParam['welcomeEmailTemplate'] = $welcomeEmailTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['sott'] = $sott; return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $authUserRegistrationModel); } @@ -980,13 +997,14 @@ public function userRegistrationByEmail($authUserRegistrationModel, $sott, * @param smsTemplate SMS Template name * @param verificationUrl Email verification url * @param welcomeEmailTemplate Name of the welcome email template + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Validation, UserProfile data and Access Token * 17.2 */ public function userRegistrationByCaptcha($authUserRegistrationModelWithCaptcha, $emailTemplate = null, $fields = "", $options = "", $smsTemplate = null, - $verificationUrl = null, $welcomeEmailTemplate = null) + $verificationUrl = null, $welcomeEmailTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/register/captcha"; $queryParam = []; @@ -1009,6 +1027,9 @@ public function userRegistrationByCaptcha($authUserRegistrationModelWithCaptcha, if ($welcomeEmailTemplate != '') { $queryParam['welcomeEmailTemplate'] = $welcomeEmailTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $authUserRegistrationModelWithCaptcha); } @@ -1039,5 +1060,31 @@ public function authResendEmailVerification($email, $emailTemplate = null, } return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, json_encode($bodyParam)); } + + + + /** + * This API is used to Send verification email to the unverified email of the social profile. This API can be used only incase of optional verification workflow. + * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. + * @param clientguid Unique string used in the Smart Login request + * @return Response containing Definition for Complete AuthSendVerificationEmailForLinkingSocialProfiles API Response + * 44.9 + */ + + public function authSendVerificationEmailForLinkingSocialProfiles($accessToken, $clientguid) + { + $resourcePath = "/identity/v2/auth/email/sendverificationemail"; + $queryParam = []; + if ($accessToken === '' || ctype_space($accessToken)) { + throw new LoginRadiusException(Functions::paramValidationMsg('accessToken')); + } + $queryParam['apiKey'] = Functions::getApiKey(); + if ($clientguid === '' || ctype_space($clientguid)) { + throw new LoginRadiusException(Functions::paramValidationMsg('clientguid')); + } + $queryParam['access_token'] = $accessToken; + $queryParam['clientguid'] = $clientguid; + return Functions::_apiClientHandler('GET', $resourcePath, $queryParam); + } } \ No newline at end of file diff --git a/src/LoginRadiusSDK/CustomerRegistration/Authentication/OneTouchLoginAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Authentication/OneTouchLoginAPI.php index 97503f9..87e4238 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Authentication/OneTouchLoginAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Authentication/OneTouchLoginAPI.php @@ -56,11 +56,13 @@ public function oneTouchLoginByEmail($oneTouchLoginByEmailModel, $oneTouchLoginE * This API is used to send one time password to a given phone number for a frictionless login/registration. * @param oneTouchLoginByPhoneModel Model Class containing Definition of payload for OneTouchLogin By PhoneModel API * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Validation data * 1.4 */ - public function oneTouchLoginByPhone($oneTouchLoginByPhoneModel, $smsTemplate = null) + public function oneTouchLoginByPhone($oneTouchLoginByPhoneModel, $smsTemplate = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/onetouchlogin/phone"; $queryParam = []; @@ -68,6 +70,9 @@ public function oneTouchLoginByPhone($oneTouchLoginByPhoneModel, $smsTemplate = if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $oneTouchLoginByPhoneModel); } diff --git a/src/LoginRadiusSDK/CustomerRegistration/Authentication/PINAuthenticationAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Authentication/PINAuthenticationAPI.php index a302461..4028139 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Authentication/PINAuthenticationAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Authentication/PINAuthenticationAPI.php @@ -168,11 +168,13 @@ public function resetPINByPhoneAndSecurityAnswer($resetPINBySecurityQuestionAnsw * This API sends the OTP to specified phone number * @param forgotPINOtpByPhoneModel Model Class containing Definition for Forgot Pin Otp By Phone API * @param smsTemplate + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response Containing Validation Data and SMS Data * 42.7 */ - public function sendForgotPINSMSByPhone($forgotPINOtpByPhoneModel, $smsTemplate = null) + public function sendForgotPINSMSByPhone($forgotPINOtpByPhoneModel, $smsTemplate = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/pin/forgot/otp"; $queryParam = []; @@ -180,6 +182,9 @@ public function sendForgotPINSMSByPhone($forgotPINOtpByPhoneModel, $smsTemplate if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $forgotPINOtpByPhoneModel); } diff --git a/src/LoginRadiusSDK/CustomerRegistration/Authentication/PasswordLessLoginAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Authentication/PasswordLessLoginAPI.php index 1e3b620..f2429d2 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Authentication/PasswordLessLoginAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Authentication/PasswordLessLoginAPI.php @@ -27,12 +27,13 @@ public function __construct($options = []) * @param passwordLessLoginOtpModel Model Class containing Definition of payload for PasswordLessLoginOtpModel API * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing User Profile Data and access token * 9.6 */ public function passwordlessLoginPhoneVerification($passwordLessLoginOtpModel, $fields = "", - $smsTemplate = null) + $smsTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/login/passwordlesslogin/otp/verify"; $queryParam = []; @@ -43,6 +44,9 @@ public function passwordlessLoginPhoneVerification($passwordLessLoginOtpModel, $ if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, $passwordLessLoginOtpModel); } @@ -52,11 +56,13 @@ public function passwordlessLoginPhoneVerification($passwordLessLoginOtpModel, $ * API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID * @param phone The Registered Phone Number * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response Containing Definition of SMS Data * 9.15 */ - public function passwordlessLoginByPhone($phone, $smsTemplate = null) + public function passwordlessLoginByPhone($phone, $smsTemplate = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/login/passwordlesslogin/otp"; $queryParam = []; @@ -67,6 +73,9 @@ public function passwordlessLoginByPhone($phone, $smsTemplate = null) if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['phone'] = $phone; return Functions::_apiClientHandler('GET', $resourcePath, $queryParam); } diff --git a/src/LoginRadiusSDK/CustomerRegistration/Authentication/PhoneAuthenticationAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Authentication/PhoneAuthenticationAPI.php index dd02359..76447b2 100644 --- a/src/LoginRadiusSDK/CustomerRegistration/Authentication/PhoneAuthenticationAPI.php +++ b/src/LoginRadiusSDK/CustomerRegistration/Authentication/PhoneAuthenticationAPI.php @@ -28,12 +28,13 @@ public function __construct($options = []) * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @param loginUrl Url where the user is logging from * @param smsTemplate SMS Template name + * @param options * @return Response containing User Profile Data and access token * 9.2.3 */ public function loginByPhone($phoneAuthenticationModel, $fields = "", - $loginUrl = null, $smsTemplate = null) + $loginUrl = null, $smsTemplate = null, $options = "") { $resourcePath = "/identity/v2/auth/login"; $queryParam = []; @@ -47,6 +48,9 @@ public function loginByPhone($phoneAuthenticationModel, $fields = "", if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($options != '') { + $queryParam['options'] = $options; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $phoneAuthenticationModel); } @@ -56,11 +60,13 @@ public function loginByPhone($phoneAuthenticationModel, $fields = "", * This API is used to send the OTP to reset the account password. * @param phone New Phone Number * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response Containing Validation Data and SMS Data * 10.4 */ - public function forgotPasswordByPhoneOTP($phone, $smsTemplate = null) + public function forgotPasswordByPhoneOTP($phone, $smsTemplate = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/password/otp"; $bodyParam = []; @@ -70,6 +76,9 @@ public function forgotPasswordByPhoneOTP($phone, $smsTemplate = null) if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -98,12 +107,13 @@ public function resetPasswordByPhoneOTP($resetPasswordByOTPModel) * @param phone New Phone Number * @param fields The fields parameter filters the API response so that the response only includes a specific set of fields * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing User Profile Data and access token * 11.1.1 */ public function phoneVerificationByOTP($otp, $phone, - $fields = "", $smsTemplate = null) + $fields = "", $smsTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/phone/otp"; $bodyParam = []; @@ -119,6 +129,9 @@ public function phoneVerificationByOTP($otp, $phone, if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['otp'] = $otp; return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -130,12 +143,13 @@ public function phoneVerificationByOTP($otp, $phone, * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @param otp The Verification Code * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Validation data * 11.1.2 */ public function phoneVerificationOTPByAccessToken($accessToken, $otp, - $smsTemplate = null) + $smsTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/phone/otp"; $queryParam = []; @@ -149,6 +163,9 @@ public function phoneVerificationOTPByAccessToken($accessToken, $otp, if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['access_token'] = $accessToken; $queryParam['otp'] = $otp; return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam); @@ -160,11 +177,13 @@ public function phoneVerificationOTPByAccessToken($accessToken, $otp, * This API is used to resend a verification OTP to verify a user's Phone Number. The user will receive a verification code that they will need to input * @param phone New Phone Number * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response Containing Validation Data and SMS Data * 11.2.1 */ - public function phoneResendVerificationOTP($phone, $smsTemplate = null) + public function phoneResendVerificationOTP($phone, $smsTemplate = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/phone/otp"; $bodyParam = []; @@ -174,6 +193,9 @@ public function phoneResendVerificationOTP($phone, $smsTemplate = null) if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -184,12 +206,13 @@ public function phoneResendVerificationOTP($phone, $smsTemplate = null) * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @param phone New Phone Number * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response Containing Validation Data and SMS Data * 11.2.2 */ public function phoneResendVerificationOTPByToken($accessToken, $phone, - $smsTemplate = null) + $smsTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/phone/otp"; $bodyParam = []; @@ -202,6 +225,9 @@ public function phoneResendVerificationOTPByToken($accessToken, $phone, if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -213,12 +239,13 @@ public function phoneResendVerificationOTPByToken($accessToken, $phone, * @param accessToken Uniquely generated identifier key by LoginRadius that is activated after successful authentication. * @param phone New Phone Number * @param smsTemplate SMS Template name + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response Containing Validation Data and SMS Data * 11.5 */ public function updatePhoneNumber($accessToken, $phone, - $smsTemplate = null) + $smsTemplate = null, $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/phone"; $bodyParam = []; @@ -231,6 +258,9 @@ public function updatePhoneNumber($accessToken, $phone, if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['access_token'] = $accessToken; return Functions::_apiClientHandler('PUT', $resourcePath, $queryParam, json_encode($bodyParam)); } @@ -288,14 +318,16 @@ public function removePhoneIDByAccessToken($accessToken) * @param smsTemplate SMS Template name * @param verificationUrl Email verification url * @param welcomeEmailTemplate Name of the welcome email template - * @param emailTemplate Name of the email template + * @param emailTemplate + * @param isVoiceOtp Boolean, pass true if you wish to trigger voice OTP * @return Response containing Definition of Complete Validation, UserProfile data and Access Token * 17.1.2 */ public function userRegistrationByPhone($authUserRegistrationModel, $sott, $fields = "", $options = "", $smsTemplate = null, - $verificationUrl = null, $welcomeEmailTemplate = null,$emailTemplate = null) + $verificationUrl = null, $welcomeEmailTemplate = null,$emailTemplate = null, + $isVoiceOtp = false) { $resourcePath = "/identity/v2/auth/register"; $queryParam = []; @@ -312,15 +344,18 @@ public function userRegistrationByPhone($authUserRegistrationModel, $sott, if ($smsTemplate != '') { $queryParam['smsTemplate'] = $smsTemplate; } - if ($emailTemplate != '') { - $queryParam['emailTemplate'] = $emailTemplate; - } if ($verificationUrl != '') { $queryParam['verificationUrl'] = $verificationUrl; } if ($welcomeEmailTemplate != '') { $queryParam['welcomeEmailTemplate'] = $welcomeEmailTemplate; } + if ($emailTemplate != '') { + $queryParam['emailTemplate'] = $emailTemplate; + } + if ($isVoiceOtp != '') { + $queryParam['isVoiceOtp'] = $isVoiceOtp; + } $queryParam['sott'] = $sott; return Functions::_apiClientHandler('POST', $resourcePath, $queryParam, $authUserRegistrationModel); } diff --git a/src/LoginRadiusSDK/CustomerRegistration/Authentication/SlidingTokenAPI.php b/src/LoginRadiusSDK/CustomerRegistration/Authentication/SlidingTokenAPI.php new file mode 100644 index 0000000..1ae3dea --- /dev/null +++ b/src/LoginRadiusSDK/CustomerRegistration/Authentication/SlidingTokenAPI.php @@ -0,0 +1,44 @@ +