mathsgod/jwt-recaptcha

using json web token for recaptcha, without session, without database

1.0.0 2020-04-08 08:51 UTC

This package is auto-updated.

Last update: 2024-10-17 19:54:10 UTC


README

using jwt for recaptcha in php

Server generate hash

$secret;

$re = new ReCaptcha($secret);
$hash = $re->hash();

echo $hash["token"]; //token sent to user, use for verify later
echo $hash["image"]; //recaptcha image

Server verify recaptcha code

$re = new ReCaptcha($secret);
$code;//get from user
$token;//get from user sent before

if($re->verify($code,$token)){
    //correct code
}else{
    //incorrect code 
}