Skip to content
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

response-handler.js incorrectly wrapping signup_on_sso_domain errors. #826

Closed
mikedecosta opened this issue Sep 12, 2018 · 0 comments · Fixed by #829
Closed

response-handler.js incorrectly wrapping signup_on_sso_domain errors. #826

mikedecosta opened this issue Sep 12, 2018 · 0 comments · Fixed by #829

Comments

@mikedecosta
Copy link

The error returned from signup is inconsistent which causes response-handler.js to set the error.code to the errors description instead of the actual code. This is true in Auth0.js v9.7.3 at least.

On code line 45 of response-handler.js, the hierarchy of values with signup_on_sso_domain errors will produce a result of the errObj.code = This domain domain.com has been configured for Single Sign On and you can't create an account. Try signing in instead.

Line 45 in question:

  errObj.code = err.error || err.code || err.error_code || err.status || null;

Here are 2 errors as an example, user_exists errors are wrapped successfully:

e:
code:"user_exists"
description:"The user already exists."
name:"BadRequestError"
    original:null
    response:l
        body:{name: "BadRequestError", code: "user_exists", description: "The user already exists.", statusCode: 400}
        text:"{"name":"BadRequestError","code":"user_exists","description":"The user already exists.","statusCode":400}"

While signup_on_sso_domain are not wrapped correctly:

e:
code:"This domain longreen.io has been configured for Single Sign On and you can't create an account. Try signing in instead."
description:"This domain longreen.io has been configured for Single Sign On and you can't create an account. Try signing in instead."
    original:null
    response:l
        body:{code: "signup_on_sso_domain", domain: "longreen.io", error: "This domain longreen.io has been configured for Si… can't create an account. Try signing in instead."}
        text:"{"code":"signup_on_sso_domain","domain":"longreen.io","error":"This domain longreen.io has been configured for Single Sign On and you can't create an account. Try signing in instead."}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant