1. Does request_language
work for Change Password emails?
No, request_language
does NOT work for the Change Password (Link) template when triggered via /dbconnections/change_password
. This is a known limitation. The request_language
variable is primarily supported for:
- Passwordless email templates
- Some verification emails
- Welcome emails in certain flows
But not for password reset emails triggered through the Management API or /dbconnections/change_password
endpoint.
2. Can you pass language parameters in the reset password request?
Unfortunately, no. The /dbconnections/change_password
endpoint and the SDK’s resetPassword
method don’t accept language parameters that flow into the email template context. The headers you tried (X-Request-Language
, Accept-Language
) are not processed by Auth0 for this specific flow.
3. Recommended approaches without user_metadata.lang
Here are your viable options, ranked by practicality:
Option 1: Use Application Metadata (Recommended)
If your app serves a specific language market, you can use the application context:
liquid
{% assign app_name = application.name | downcase %}
{% if app_name contains 'dutch' or app_name contains 'nl' %}
<h1>Wachtwoord opnieuw instellen</h1>
<p>Klik op de onderstaande link om uw wachtwoord opnieuw in te stellen:</p>
{% else %}
<h1>Reset Password</h1>
<p>Click the link below to reset your password:</p>
{% endif %}
Or use application metadata if you configure it:
liquid
{% if application.metadata.default_language == 'nl' %}
<h1>Wachtwoord opnieuw instellen</h1>
{% else %}
<h1>Reset Password</h1>
{% endif %}
Option 2: User Email Domain Detection
Use the user’s email domain to infer language:
liquid
{% assign email_domain = user.email | split: '@' | last %}
{% if email_domain contains '.nl' or email_domain == 'company.nl' %}
<h1>Wachtwoord opnieuw instellen</h1>
{% else %}
<h1>Reset Password</h1>
{% endif %}
Option 3: Custom Email Provider (Most Flexible)
Switch to a custom email provider where you have full control:
- Configure a custom email provider (SendGrid, Mailgun, etc.)
- Create an Auth0 Action that triggers on password reset
- Send custom emails with full language support
Example Action:
javascript
exports.onExecutePostChangePassword = async (event, api) => {
const { user, request } = event;
// You can capture language from custom claims or other sources
const language = user.app_metadata?.language || 'en';
// Send custom email via your provider
await sendCustomPasswordResetEmail(user.email, language);
// Optionally suppress Auth0's default email
// (This requires configuration changes)
};
Option 4: Multiple Applications Approach
Create separate Auth0 applications for different languages:
myapp-en
for English users
myapp-nl
for Dutch users
Then use application-specific templates or route users to the appropriate application based on their language preference.
Option 5: Workaround with User Metadata
If you can capture language during any user interaction (login, signup, profile update), store it in user metadata:
javascript
// During any authenticated flow
await auth0.users.updateUserMetadata(user.sub, {
language: 'nl'
});
Then use in template:
liquid
{% if user.user_metadata.language == 'nl' %}
<h1>Wachtwoord opnieuw instellen</h1>
{% else %}
<h1>Reset Password</h1>
{% endif %}
Alternative: Geographic Detection
You could also use a hybrid approach with JavaScript in your email template (though limited):
liquid
<script>
// Basic geographic/browser language detection
const browserLang = navigator.language || navigator.userLanguage;
const isNL = browserLang.startsWith('nl');
if (isNL) {
document.querySelector('.email-content').innerHTML = `
<h1>Wachtwoord opnieuw instellen</h1>
<p>Klik op de onderstaande link om uw wachtwoord opnieuw in te stellen:</p>
`;
}
</script>