webiny-cognito-federation

Configures Cognito federated sign-in with external identity providers for Webiny projects.

8.0k|673|Updated Jan 9, 2018
One-click install
npx skills add https://github.com/webiny/webiny-js --skill webiny-cognito-federation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: webiny-cognito-federation
Source: https://github.com/webiny/webiny-js/tree/main/skills/user-skills/cognito-federation
Command: npx skills add https://github.com/webiny/webiny-js --skill webiny-cognito-federation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Setting up SSO for a Webiny admin app requires coordinating Cognito User Pool infrastructure, OAuth client settings, the admin login screen, and API-side identity mapping. This Skill guides you through configuring federated sign-in (Google, Facebook, Apple, Amazon, OIDC/Entra ID) while keeping Cognito as the user pool, so users authenticate via external providers and are auto-synced into Webiny.

Core Features & Use Cases

  • Federation via <Cognito /> prop: Add a federation object in webiny.config.tsx to provision the Cognito User Pool Domain, IdP resources, and OAuth client, plus provider buttons on the login screen.
  • Custom identity mapping: Use apiConfig with CognitoIdpConfig to map JWT claims (e.g., Cognito groups) to Webiny roles and teams.
  • Custom login screen: Use adminConfig with CognitoSignInConfig to control provider buttons, credentials visibility (e.g., IP whitelists), titles, and custom button components.
  • Use Case: Add a "Sign in with Microsoft" button backed by Entra ID OIDC, hide the password form, and map Entra groups to Webiny roles — all from one config file.

Quick Start

Add a federation prop with domain, callbackUrls, and identityProviders to the Cognito component in webiny.config.tsx, then run yarn webiny deploy.

Frequently Asked Questions about webiny-cognito-federation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Google or Microsoft login to a Webiny Cognito user pool?

Add a federation prop to the <Cognito /> component in webiny.config.tsx with a domain, callbackUrls, and an identityProviders array containing your provider type and credentials. This provisions the Cognito IdP resources, OAuth client, and login screen buttons automatically.

How do I map Cognito groups to Webiny roles and teams?

Create an apiConfig extension implementing CognitoIdpConfig.Interface with a getIdentity method that reads claims like cognito:groups from the JWT and returns roles and teams slugs. Reference the file via the apiConfig prop on <Cognito />.

Can I hide the email/password form when using federated login?

Yes, set allowCredentialsLogin to false in the federation object to hide the credentials form. For conditional logic such as IP whitelists, implement a custom CognitoSignInConfig via the adminConfig prop.

Does Webiny Cognito federation support OIDC providers like Entra ID?

Yes, use type "oidc" with a custom name, label, and providerDetails including client_id, client_secret, and oidc_issuer. You can also pass federation as an async function to fetch credentials from a secrets manager at deploy time.

Why is the custom:id attribute mapping important in Cognito federation?

Webiny uses custom:id as the primary user identifier, mapped to the IdP's sub claim by default. Always include it in custom attributeMapping unless the IdP's sub exceeds 36 characters on pools deployed before Webiny 6.4.4.

When should I use Okta or Auth0 instead of Cognito federation?

Cognito federation keeps Cognito as the user pool while delegating authentication to external IdPs. If you want Okta or Auth0 to fully replace Cognito as the identity provider, use the dedicated webiny-configure-okta or webiny-configure-auth0 skills instead.