/recaptcha3

reCAPTCHA v3 backend tools

Primary LanguageGo

reCAPTCHA v3 verifier

Call Verify to perform verify request ( https://developers.google.com/recaptcha/docs/verify#api_request ).

Basic usage

verifier := NewVerifier(&http.Client{})

resp, err := verifier.Verify(context.Background(), "secret", "token", "")
if err != nil {
    return err
} 
if !resp.Success {
    return errors.New("you are bot")
}

Specify request timeout

verifier := NewVerifier(&http.Client{})

ctx, cancelFunc := context.WithTimeout(context.Background(), time.Second*10)
defer cancelFunc()

resp, err := verifier.Verify(ctx, "secret", "token", "")
if err != nil {
    return err
}