/// <summary> /// This API is used to trigger the Multi-factor authentication settings after login for secure actions /// </summary> /// <param name="accessToken">Uniquely generated identifier key by LoginRadius that is activated after successful authentication.</param> /// <param name="multiFactorAuthModelWithLockout">Model Class containing Definition of payload for MultiFactorAuthModel With Lockout API</param> /// <param name="fields">The fields parameter filters the API response so that the response only includes a specific set of fields</param> /// <returns>Response containing Definition for Complete profile data</returns> /// 5.9 public ApiResponse <Identity> MFAUpdateSetting(string accessToken, MultiFactorAuthModelWithLockout multiFactorAuthModelWithLockout, string fields = "") { if (string.IsNullOrWhiteSpace(accessToken)) { throw new ArgumentException(BaseConstants.ValidationMessage, nameof(accessToken)); } if (multiFactorAuthModelWithLockout == null) { throw new ArgumentException(BaseConstants.ValidationMessage, nameof(multiFactorAuthModelWithLockout)); } var queryParameters = new QueryParameters { { "access_token", accessToken }, { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] } }; if (!string.IsNullOrWhiteSpace(fields)) { queryParameters.Add("fields", fields); } var resourcePath = "identity/v2/auth/account/2fa/verification/otp"; return(ConfigureAndExecute <Identity>(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(multiFactorAuthModelWithLockout))); }
/// <summary> /// This API is used to login via Multi-factor authentication by passing the One Time Password received via SMS /// </summary> /// <param name="multiFactorAuthModelWithLockout">Model Class containing Definition of payload for MultiFactorAuthModel With Lockout API</param> /// <param name="secondFactorAuthenticationToken">A Uniquely generated MFA identifier token after successful authentication</param> /// <param name="fields">The fields parameter filters the API response so that the response only includes a specific set of fields</param> /// <param name="smsTemplate2FA">SMS Template Name</param> /// <returns>Complete user UserProfile data</returns> /// 9.12 public ApiResponse <AccessToken <Identity> > MFAValidateOTPByPhone(MultiFactorAuthModelWithLockout multiFactorAuthModelWithLockout, string secondFactorAuthenticationToken, string fields = "", string smsTemplate2FA = null) { if (multiFactorAuthModelWithLockout == null) { throw new ArgumentException(BaseConstants.ValidationMessage, nameof(multiFactorAuthModelWithLockout)); } if (string.IsNullOrWhiteSpace(secondFactorAuthenticationToken)) { throw new ArgumentException(BaseConstants.ValidationMessage, nameof(secondFactorAuthenticationToken)); } var queryParameters = new QueryParameters { { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] }, { "secondFactorAuthenticationToken", secondFactorAuthenticationToken } }; if (!string.IsNullOrWhiteSpace(fields)) { queryParameters.Add("fields", fields); } if (!string.IsNullOrWhiteSpace(smsTemplate2FA)) { queryParameters.Add("smsTemplate2FA", smsTemplate2FA); } var resourcePath = "identity/v2/auth/login/2fa/verification/otp"; return(ConfigureAndExecute <AccessToken <Identity> >(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(multiFactorAuthModelWithLockout))); }