Captcha-reCAPTCHA-V3
view release on metacpan or search on metacpan
Requires just only response key being got from Google reCAPTCHA API.
**DO NOT** add remote address. there is no function for remote address within reCAPTCHA v3.
my $content = $rc->verify($param{$rc});
The default _query\_name_ is 'g-recaptcha-response' and it is stocked in constructor.
But now string-context provides you to get _query\_name_ so we don't have to care about it.
The response contains JSON so it returns decoded value from JSON.
unless ( $content->{'success'} ) {
# code for failing like below
die 'fail to verify reCAPTCHA: ', @{ $content->{'error-codes'} }, "\n";
}
### deny\_by\_score( response => _response_, \[ score => _expected_ \] )
reCAPTCHA v3 responses have score whether the request was by bot.
lib/Captcha/reCAPTCHA/V3.pm view on Meta::CPAN
response => $response || croak "missing response token",
};
my $ua = LWP::UserAgent->new();
# Enable LWP debugging
use LWP::Debug qw(+);
my $res = $ua->post( $self->{'verify_api'}, $params );
if ( $res->is_success ) {
return decode_json( $res->decoded_content );
} else {
croak $res->status_line;
}
}
sub deny_by_score {
my $self = shift;
my %attr = @_;
my $response = $attr{'response'} || croak "missing response token";
my $score = $attr{'score'} || 0.5;
lib/Captcha/reCAPTCHA/V3.pm view on Meta::CPAN
Requires just only response key being got from Google reCAPTCHA API.
B<DO NOT> add remote address. there is no function for remote address within reCAPTCHA v3.
my $content = $rc->verify($param{$rc});
The default I<query_name> is 'g-recaptcha-response' and it is stocked in constructor.
But now string-context provides you to get I<query_name> so we don't have to care about it.
The response contains JSON so it returns decoded value from JSON.
unless ( $content->{'success'} ) {
# code for failing like below
die 'fail to verify reCAPTCHA: ', @{ $content->{'error-codes'} }, "\n";
}
=head3 deny_by_score( response => I<response>, [ score => I<expected> ] )
reCAPTCHA v3 responses have score whether the request was by bot.
( run in 0.243 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )