Pass Language Parameters To Amazon Web Services Cognito Using Upstream Parameters

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.

  1. Go to the Auth0 Dashboard.

  2. Select Applications > APIs.

  3. Select the Auth0 Management API.

  4. Select the API Explorer tab.

  5. Copy the token provided.

Retrieve the current connection options.

  1. Go to the Get a connection by ID endpoint of the Auth0 Management API.

  2. Click Set API Token and provide the token retrieved in step 1.

  3. Locate the connection ID in the Auth0 Dashboard under Connections.

  4. Copy the connection ID displayed next to the connection name.

  5. Enter the connection ID in the id field.

  6. Click Test Endpoint and copy the options object from the result.

Modify the options object.

  1. Add the upstream_params object to the end of the options object.

  2. Ensure the lang parameter acts as the alias for ui_locales.

JSON
 
"upstream_params": {
    "lang": {
        "alias": "ui_locales"
    }
},

Update the connection.

  1. Go to the Update a connection endpoint of the Auth0 Management API.

  2. Enter the API key and the connection ID.

  3. Paste the modified options object into the body using the following format:

JSON
 
{
    "options": {
        ...
        "upstream_params": {
        "lang": {
            "alias": "ui_locales"
            }
        },
        ...
    }
}

  1. 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.

Recommended content

No recommended content found...