Exemple #1
0
 /// <summary>
 /// Requests the hCaptcha API via the provided <see cref="IHCaptchaApi"/>. Timeout configuration is provided via <paramref name="cancellationToken"/>
 /// </summary>
 /// <param name="token">The client's token.</param>
 /// <param name="remoteIp">Optional the client's IP address</param>
 /// <param name="cancellationToken"></param>
 /// <returns><see cref="HCaptchaVerifyResponse"/></returns>
 /// <exception cref="HCaptchaApiException">if request failed.</exception>
 public async Task <HCaptchaVerifyResponse> Verify(string token, string remoteIp = null, CancellationToken cancellationToken = default)
 {
     try
     {
         return(await _captchaApi.Verify(_captchaOptions.Secret, token,
                                         _captchaOptions.VerifyRemoteIp?remoteIp : null, cancellationToken).ConfigureAwait(false));
     }
     catch (ApiException e)
     {
         throw new HCaptchaApiException(e.StatusCode, e);
     }
 }
 /// <summary>
 /// Requests the hCaptcha API via the provided <see cref="IHCaptchaApi"/>.
 /// </summary>
 /// <param name="token">The client's token.</param>
 /// <param name="remoteIp">Optional the client's IP address</param>
 /// <param name="cancellationToken"></param>
 /// <returns><see cref="HCaptchaVerifyResponse"/></returns>
 public async Task <HCaptchaVerifyResponse> Verify(string token, string remoteIp = null, CancellationToken cancellationToken = default)
 {
     return(await _captchaApi.Verify(_captchaOptions.Secret, token,
                                     _captchaOptions.VerifyRemoteIp?remoteIp : null).ConfigureAwait(false));
 }