auth0 / auth0.js

Auth0 headless browser sdk
MIT License
997 stars 492 forks source link

Cannot seem to use renderPasswordlessCaptcha #1455

Open REX500 opened 3 months ago

REX500 commented 3 months ago

Checklist

Description

Reading Auth-0's documentation on "Add Bot Detection to Custom Login Pages," they mention that we can use the renderPasswordlessCaptcha function to append a captcha challenge to a document element. Reading your documentation, I can see that there is a mention on https://auth0.github.io/auth0.js/WebAuth.html#renderPasswordlessCaptcha about using that same function to render a captcha challenge. Whenever I try to append the captcha element to a div element using renderPasswordlessCaptcha, I get the following error shown in the console:

chunk-KIZHJP3H.js?v=c559862b:16417 Uncaught TypeError: Cannot read properties of undefined (reading 'required')
    at challengeCallback (auth0-js.js?v=9947444d:4169:94)
    at PasswordlessAuthentication.getChallenge (auth0-js.js?v=9947444d:4416:12)
    at load (auth0-js.js?v=9947444d:4236:80)
    at Object.render (auth0-js.js?v=9947444d:4238:72)
    at WebAuth.renderPasswordlessCaptcha (auth0-js.js?v=9947444d:4386:18)
    at component.tsx:240:21
    at sentryWrapped (chunk-JP3H.js?v=c519862b:16400:17)

I initialize the WebAuth instance using: export const webAuth0Instance = new auth0.WebAuth(auth0Config); and as such, I am able to run a variety of functions including, but not limited to:


Furthermore, on the official readme page: https://github.com/auth0/auth0.js#readme there is no mention of any captcha functions other than

[renderCaptcha(element, options, callback)](https://auth0.github.io/auth0.js/WebAuth.html#renderCaptcha)

so I am wondering if your official docs page: https://auth0.github.io/auth0.js/WebAuth.html is out of date or what? Furthermore #2: the @types package for this module also doesn't list any captcha functions other than renderCaptcha: https://www.npmjs.com/package/@types/auth0-js

Can someone tell me how I can achieve a passwordless captcha flow using your package, and if it's even possible?

Reproduction

  1. setup web auth client with proper credentials
  2. create an element in dom with custom classname - just a simple div with nothing inside of it, per auth-0 docs step 2: https://auth0.com/docs/secure/attack-protection/bot-detection/bot-detection-custom-login-pages#support-passwordless-flows
  3. try to append passwordless captcha using web auth client you initialized in step1 and call any of the captcha functions (none should work): renderCaptcha, renderPasswordlessCaptcha and renderPasswordResetCaptcha
  4. you should see an error in the console

Additional context

No response

auth0-js version

9.26.1

Which browsers have you tested in?

Chrome