mathsgod/jwt-recaptcha

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

2.0.0 2024-11-28 07:19 UTC

This package is auto-updated.

Last update: 2024-11-28 07:20:36 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 
}