Skip to main content

Command Palette

Search for a command to run...

How to Configure AWS Cognito for SSO: A Step-by-Step Guide

Updated
3 min read

Creating App Client for Each Customer

According to the multi-tenant application model, we need to create a separate Cognito App Client for each customer and attach their corresponding external OIDC providers.

Step 1: Creating Application Client

To create App Client navigate to Application - App client, click to Create App Client

Image description

In the setup form, choose Traditional web application as the application type.

Image description

Step 2: Adding custom attribute

To include user groups in the ID token, we need to add a custom attribute to the Cognito User Pool.

  1. Navigate to Authentication - Sign Up, then click Add custom attribute:
Image description

In the form, enter the attribute name as shown below, and then click Save changes.

Image description

Adding roles custom attribute

If “roles” scope is configured in Customer OIDC provider, you can add a custom “roles” attribute as well and include this attribute in External Cognito Provider.

Image description

Step 3:  Creating External Provider

  1. Navigate to Authentication - Social and external providers
Image description
  1. In from enter your OIDC Provider credentials, Client ID, Client Secret and Issuer URI.

  2. Add custom “groups” attributes that you created in the previous step and include email attributes. (username will be added automatically after you created the provider).

Image description Image description

!Important: In the form, enter the OpenID Connect attribute to groups exactly as shown below, and then click Save changes.

Clarification: We configure these attributes so that the group and role information (optional) is included in the ID Token returned by the Identity Provider. If your application uses different scope names, make sure to update the values in the Cognito accordingly (for example, if Provider sends roles under app_groups scope, you should set OpenID Connect attribute to app_groups).

Info: If you added a “custom:roles” attribute in the previous step, you can include the “roles” attribute here as well.

Image description

Step 4: Attach External Provider to App client

  1. Navigate to App Clients - Your App - Login Pages

  2. Click Edit button.

Image description

In the configuration form:

  1. Add allowed callback URLs (e.g.

https://yourapp.com/api/oidc/cognito/callback/

or http://localhost:8000/api/oidc/cognito/callback/ for local testing).

  1. Attach the identity providers you created in the previous steps.

  2. !Important: Under OpenID Connect scopes, select only the OpenId scope.

  3. Click Save changes.

Image description

After custom attributes setup check in Attribute Permission that Read and Write permissions are checked:

Image description

Step 5: Attach Login Page to the App client

  1. Navigate to Your User Pool - Managed login.

  2. Click Create a style button.

Image description
  1. Select the App client you want to attach a login page to.

  2. Click Create.

Image description

After creation, the login page for your App Client will become available and can be accessed directly via its generated URL.

Image description

How to connect to your application

To enable Cognito login for your users in your application, you need to retrieve the following three parameters:

  1. Client ID

  2. Client Secret

  3. User Pool Cognito domain

You can find this data on our Cognito User Pool and App client pages.

To copy Client ID and Client Secret Navigate to corresponding App client:

Image description

To get User Pool Cognito domain, navigate to Domain page:

Image description

Cognito Setup Complete. Your Cognito configuration is now complete and ready for SSO testing.

Enterprise SSO with Django

Part 4 of 6

A hands-on series on implementing enterprise Single Sign-On (SSO) in a Django application. Covers configuring Azure AD and Okta as identity providers, setting up AWS Cognito as the OIDC broker, wiring SSO providers through the Django admin panel, and testing the full login, logout, and group validation flow end-to-end.

Up next

Okta Single Sign-On (SSO) Setup: A Step-by-Step Guide

Configuring SSO authentication in Okta After logging into the Okta panel, you will be redirected to the dashboard. From here, we will configure Okta to enable Single Sign-On (SSO) authentication for o