Reputation: 301
this undefined error is thrown by Azure B2C when i try to signup an existing user can i fix this issue somhow?
Upvotes: 3
Views: 1276
Reputation: 36
This issue has been fixed with selfasserted version 2.1.19. See: https://learn.microsoft.com/en-us/answers/questions/1154586/azure-b2c-gives-undefined-as-the-error-message-whe and https://learn.microsoft.com/en-us/azure/active-directory-b2c/page-layout#self-asserted-page-selfasserted
Upvotes: 2
Reputation: 3647
To workaround this issue and display the correct error message, you can do the following:
errorCode
and message
properties.
<body>
tag), replacing the error code and message with the one from your devtools. If you like, you can also customise the error message.<script type="text/javascript">
if (CONTENT) {
CONTENT['UserAccountNotFound'] = CONTENT['UserAccountNotFound'] ?? 'A user with the specified credential could not be found.'
}
</script>
It seems that undefined
is being displayed due to Microsoft having a bug in the page's JavaScript. The variable u
is initially set to the correct message, while f
is set to the string 'undefined'
as the errorCode
is not found in the page's lookup dictionary. Then the next line contains u = f
which results in the string 'undefined'
being printed as the error.
To workaround this, we need lookupLanguage
to return the correct string. To do this, we need to add items to the page's lookup dictionary, which helpfully is a global variable named CONTENT
that can be easily modified in a custom script.
In the future, Microsoft will hopefully fix this bug so that the workaround will no longer be needed.
Upvotes: 2