Overview
This article explains why event.request.language
is always undefined in both post-login and post-challenge actions despite the Accept-Language header being sent by the browser and provides a potential workaround.
Applies To
- post-login action
- post-challenge action
- Localization
- Accept-Language header
Solution
This is a known issue. As of October 2024 there is no timeline for when it will be addressed.
In the meantime, one workaround would be to provide a custom parameter to /authorize
that would include the locale. As there is no way to retrieve it in JavaScript, it would be necessary to retrieve the value from the Accept-Language header server-side and then provide it in the /authorize
request, if possible. The value can then be accessed from within an action via event.request.query.<parameter name>
.