Pass Language Parameters To Amazon Web Services Cognito Using Upstream Parameters
Last Updated:
Overview
Amazon Web Services (AWS) Cognito requires the lang parameter to set the language and does not support browser language detection. This article explains how to pass the lang query parameter via an AWS Cognito connection using Upstream Parameters. This process involves adding ui_locales to the initial /authorize call as a query parameter and mapping it to the lang parameter in the connection using the Auth0 Management API.
Applies To
- Amazon Web Services (AWS) Cognito
- Auth0 Management API
- Upstream Parameters
Solution
Obtain the API key.
-
Go to the Auth0 Dashboard.
-
Select Applications > APIs.
-
Select the Auth0 Management API.
-
Select the API Explorer tab.
-
Copy the token provided.
Retrieve the current connection options.
-
Go to the Get a connection by ID endpoint of the Auth0 Management API.
-
Click Set API Token and provide the token retrieved in step 1.
-
Locate the connection ID in the Auth0 Dashboard under Connections.
-
Copy the connection ID displayed next to the connection name.
-
Enter the connection ID in the id field.
-
Click Test Endpoint and copy the
optionsobject from the result.
Modify the options object.
-
Add the
upstream_paramsobject to the end of theoptionsobject. -
Ensure the
langparameter acts as the alias forui_locales.
"upstream_params": {
"lang": {
"alias": "ui_locales"
}
},
Update the connection.
-
Go to the Update a connection endpoint of the Auth0 Management API.
-
Enter the API key and the connection ID.
-
Paste the modified
optionsobject into the body using the following format:
{
"options": {
...
"upstream_params": {
"lang": {
"alias": "ui_locales"
}
},
...
}
}
-
Click Test Endpoint. A 200 response indicates the connection updated successfully.
Initiate the login flow by supplying the ui_locales=[language] parameter as a query string in the /authorize call. Auth0 automatically converts this to lang=[language] and passes it to AWS Cognito.