-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IAMRISK-3011] Auth0 V2 Captcha failOpen support #1382
[IAMRISK-3011] Auth0 V2 Captcha failOpen support #1382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice start, left some comments to address
src/web-auth/captcha.js
Outdated
@@ -189,6 +189,23 @@ function injectCaptchaScript(element, opts, callback, setValue) { | |||
window.arkose = arkose; | |||
callback(arkose); | |||
}; | |||
} else if (opts.provider === AUTH0_V2_CAPTCHA_PROVIDER) { | |||
var a0RetryCount = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't have a separate variable for Auth0 V2, we can use the retryCount variable since when this script runs there will always be one provider so the counter will only represent the retries for that provider.
src/web-auth/captcha.js
Outdated
@@ -189,6 +189,23 @@ function injectCaptchaScript(element, opts, callback, setValue) { | |||
window.arkose = arkose; | |||
callback(arkose); | |||
}; | |||
} else if (opts.provider === AUTH0_V2_CAPTCHA_PROVIDER) { | |||
var a0RetryCount = 0; | |||
attributes['error-callback'] = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct. Are you trying to retry the script loading? That should be done through the attribute 'onerror' like Arkose example above. Also let's try to combine the code since it's identical to Arkose.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement#examples
src/web-auth/captcha.js
Outdated
if (a0RetryCount < MAX_RETRY) { | ||
setValue(); | ||
globalForCaptchaProvider(challenge.provider).reset(widgetId); | ||
a0RetryCount++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to use the retryCount variable.
src/web-auth/captcha.js
Outdated
globalForCaptchaProvider(challenge.provider).reset(widgetId); | ||
a0RetryCount++; | ||
} else { | ||
// similar implementation to ARKOSE_PROVIDER failOpen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for comment, let's remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
Made changes to allow auth0_v2 to handle failOpen by passing a distinct dummy token.
References
https://auth0team.atlassian.net/browse/IAMRISK-3011