I want to create a rule in auth0 that will add user’s language to user’s id token. So is there any way to achieve that? I can get country code and some other info from geoip but I can’t get language anywhere
Is there any way to get user's language in auth0 rules?
290 views Asked by Ask At
1
If you don't already have the langauge you could collect the user's language during the signup process by using the
additionalsignupfields
option in Lock to show a drop-down of languages. The user would then select an option during sign up and the selected value can be persisted inuser_metadata
.Alternatively, you can customize your login page using JavaScript to detect the user's browser language, then auto-populate an
additionalsignupfield
in Lock with the value. We could even make this a hidden field if necessary.Once stored in
user_metadata
we can then add that to theid_token
something like: