Announcement

Collapse
No announcement yet.

Google reCAPCHA v3 URL construction

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Google reCAPCHA v3 URL construction

    Good morning all,
    I am working on setting up a google recaptcha v3 on our site. I am passing the token to a landing page (and it's showing up in the output; however, I need to append this token to a URL request. When I do a simple concatenation, the secret key shows up - but the token does not. Additionally, when I output the full URL (see below) it results in '0'. Is this an issue of needing to urlencode the token? Has anyone successfully used v3 of recaptcha?

    Code:
    Recaptcha token passed = &mvta:global:g-recaptcha-response; <br>
    
    <mvt:assign name="g.recaptcha_url" value="'https://www.google.com/recaptcha/api/siteverify?secret=[mySecret]&response='"/>
    <mvt:assign name="g.newrecaptcha_url" value="g.recaptcha_url $ g.g-recaptcha-response"/>
    <br><br>
    The recaptcha URL is: &mvt:global:recaptcha_url; <br><br>
    The NEW recaptcha URL is: &mvt:global:newrecaptcha_url; <br><br>
    
    
    <mvt:call action="g.newrecaptcha_url" method="'RAW'" content-type="'application/json'">
        <mvt:assign name="l.settings:jsonRecapcha" value="l.settings:json $ s.callvalue" />
        jsonRecapcha = &mvt:jsonRecapcha;<br>
    </mvt:call>

    #2
    You probably need to escape the "-" signs in g.g-recaptcha-response. Right now the engine is probably thinking you are trying to do g.g minus unscoped recaptcha minus unscoped response which gives you 0. Try something like "g.g\-recaptcha\-response.
    David Carver
    Miva, Inc. | Software Developer

    Comment

    Working...
    X