I am redirecting my application users to the Okta login page for authentication.
Recently, I enabled User Self-Registration and implemented an Okta Registration inline Webhook that calls my application’s API to confirm to allow or deny the registration. The application API responds with either allow or deny, and in the deny case, it includes an error message.
Since my application is used by both Canada English and Canada French users, I would like the registration deny error message that is received form my API to appear in the language as the user’s browser language in the Okta registration form UI.
Currently, Okta is already displaying its own UI labels and text in the browser language, but for the Registration Webhook deny case, I want to return localized error messages.
Question:
Is there a way to get the language code (e.g., en-CA / fr-CA) from the Registration inline Webhook request to my API? OR any other alternative way? so that I can give error message in that language from my API response.
Or Can I send both language error messages with i18n param set into the registration inline webhook response like how we customize the signin widget errors?
Thank you for reaching out here on the Okta Developer Forum. We noticed that your question is more closely related to [topic/issue/domain]. To ensure you receive the most accurate and timely assistance, we recommend reposting your query on Okta’s Community at: Okta Help Center (Lightning)
Okta’s teams on the Community are better equipped to provide the comprehensive support and guidance you need as they have the specialised knowledge and expertise in [topic/issue/domain].
We appreciate your understanding and are committed to ensuring you receive the best possible support. If you have any other questions or issues related to Okta’s developer tools and API’s, feel free to post them here, and we’ll be happy to assist!
I wonder if you could just add a language attribute to the User Profile and the User Profile Enrollment policy so that the user has to select their language during registration. Then when your endpoint receives the registration request, it can know in which language the error should be returned.
Thank you @andrea for the update. I was initially looking to see if the OKTA Registration hook natively supports error messages in different languages, but I found that this is not possible.
As you mentioned, I wanted to add a new attribute to the OKTA default user profile and update the enrollment policy. However, I noticed that a default attribute called “preferredLanguage” already exists in the OKTA user profile.
So, I changed the attribute setting from Read-only to Read/Write and then updated the user enrollment policy, which made the Preferred Language input field appear in the registration form UI. Since I didn’t want customers to manually provide this value, I customized the Sign-In Page code to detect the browser language using JavaScript, set the field programmatically with that value, and hid the field in the UI.
After testing, everything is working as expected. Thank you again for your solution.