How to get Google reCaptcha v2 to work in Ember Octane

I am upgrading to Ember Octane and I am using ember-g-recaptcha ember-g-recaptcha - npm. The project README.MD has not been updated to reflect Ember Octane. The reCaptchaResponse in the component js keeps coming back undefined. How do I fix this?

I have posted the Ember-Twiddle here Ember Twiddle. Note: you will need to provide a sitekey to use it.

Thats what I do:

<GRecaptcha 
    @size="normal" 
    @sitekey={{this.siteKey}} 
    @onSuccess={{action "onCaptchaResolved"}} 
    @onExpired={{action "onCaptchaExpired"}} 
    @ref={{mut this.googleRecaptcha}} 
/>

Hey, at first blush there’s nothing obviously wrong here, but I can’t actually get to a point where I can reproduce the problem on Twiddle—the environment just isn’t meant to work quite this way. Can you upload that same example to a GitHub repo? I’m happy to pull it down and try to get it working!

I have posted the code in GitHub here: https://github.com/IlliterateUser/GoogleReCaptcha

Although, the page is not displaying and the console is not throwing any errors. I will need to look at this further today.

The code you posted is just the base template for an Ember app—looks like you forgot to git push your changes! Once you have the version not working, I’ll take a look!

It is OK. I was able to fix the problem. Sorry for the confusion.

Glad you solved the issue, if you have a chance to share on this thread how you fixed it, that helps other people who search and find this later.

The solution was simple enough - the two reCaptcha properties needed to be declared in the component, but not as tracked properties:

googleRecaptcha = null; reCaptchaResponse = null;