[PR #4229] [MERGED] feat(cognito): add amazon cognito provider #13512

Closed
opened 2026-04-13 08:58:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4229
Author: @ShobhitPatra
Created: 8/26/2025
Status: Merged
Merged: 8/29/2025
Merged by: @himself65

Base: canaryHead: feat/aws-cognito-provider


📝 Commits (7)

  • 8257356 feat(cognito): add aws-cognito provider
  • 4529e92 docs(cognito): add docs for amazon cognito provider
  • fc41873 docs(cognito): fixed wrong imports and added additional info
  • dc50d4e fix(cognito): add runtime validation for userPoolId and ensure proper naming convention
  • c56a8d7 fix(cogninto): resolve JWT security vulnerabilities
  • f27728f docs(cognito): fix incorrect socialProvider configuration
  • bce692f fix(cognito): fix typo Region and UserpoolId to smallcase

📊 Changes

4 files changed (+365 additions, -0 deletions)

View changed files

📝 docs/components/sidebar-content.tsx (+19 -0)
docs/content/docs/authentication/cognito.mdx (+78 -0)
packages/better-auth/src/social-providers/cognito.ts (+265 -0)
📝 packages/better-auth/src/social-providers/index.ts (+3 -0)

📄 Description

Description

This PR adds a new Amazon Cognito provider to Better Auth.

Changes

  • Introduced new cognito provider in /packages/better-auth/src/providers/cognito.ts
  • modified /packages/better-auth/src/providers/index.ts
  • added docs : created new cognito.mdx file and added it to the sidebar

Notes

  • Tested the implementation in demo/nextjs

Summary by cubic

Add Amazon Cognito as a social provider to Better Auth, enabling sign-in with Cognito User Pools. Includes token verification, profile mapping, and docs with a sidebar link.

  • New Features
    • New Cognito provider with Authorization Code flow and default scopes: openid, profile, email.
    • Config options: domain, region, userPoolId, clientId, clientSecret, scope, prompt, mapProfileToUser.
    • ID token verification checks issuer, audience, and expiry; overrideable or disableable.
    • User info resolved from id_token (preferred) or the userinfo endpoint.
    • Refresh token support via the shared refreshAccessToken helper.
    • Exported in social-providers index and added docs page + “Cognito” entry in the docs sidebar.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4229 **Author:** [@ShobhitPatra](https://github.com/ShobhitPatra) **Created:** 8/26/2025 **Status:** ✅ Merged **Merged:** 8/29/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/aws-cognito-provider` --- ### 📝 Commits (7) - [`8257356`](https://github.com/better-auth/better-auth/commit/82573568b25d8ede902798e6192efc3d8c1171a6) feat(cognito): add aws-cognito provider - [`4529e92`](https://github.com/better-auth/better-auth/commit/4529e92814fa53b8366694cf226707b2710918bd) docs(cognito): add docs for amazon cognito provider - [`fc41873`](https://github.com/better-auth/better-auth/commit/fc418739a02c05d03a4d129e8e626f835dd421e3) docs(cognito): fixed wrong imports and added additional info - [`dc50d4e`](https://github.com/better-auth/better-auth/commit/dc50d4ecbf00e53047bea2c8b5fb65fd6e158fdd) fix(cognito): add runtime validation for userPoolId and ensure proper naming convention - [`c56a8d7`](https://github.com/better-auth/better-auth/commit/c56a8d7f8e53de277097d488833151755b302013) fix(cogninto): resolve JWT security vulnerabilities - [`f27728f`](https://github.com/better-auth/better-auth/commit/f27728f0a21998fc0a777dc58903ac19ce48dc25) docs(cognito): fix incorrect socialProvider configuration - [`bce692f`](https://github.com/better-auth/better-auth/commit/bce692f2bb237b90d61ff04d3211fc9d7ee69415) fix(cognito): fix typo Region and UserpoolId to smallcase ### 📊 Changes **4 files changed** (+365 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/sidebar-content.tsx` (+19 -0) ➕ `docs/content/docs/authentication/cognito.mdx` (+78 -0) ➕ `packages/better-auth/src/social-providers/cognito.ts` (+265 -0) 📝 `packages/better-auth/src/social-providers/index.ts` (+3 -0) </details> ### 📄 Description ## Description This PR adds a new Amazon Cognito provider to Better Auth. ## Changes - Introduced new cognito provider in /packages/better-auth/src/providers/cognito.ts - modified /packages/better-auth/src/providers/index.ts - added docs : created new cognito.mdx file and added it to the sidebar ## Notes - Tested the implementation in demo/nextjs <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add Amazon Cognito as a social provider to Better Auth, enabling sign-in with Cognito User Pools. Includes token verification, profile mapping, and docs with a sidebar link. - **New Features** - New Cognito provider with Authorization Code flow and default scopes: openid, profile, email. - Config options: domain, region, userPoolId, clientId, clientSecret, scope, prompt, mapProfileToUser. - ID token verification checks issuer, audience, and expiry; overrideable or disableable. - User info resolved from id_token (preferred) or the userinfo endpoint. - Refresh token support via the shared refreshAccessToken helper. - Exported in social-providers index and added docs page + “Cognito” entry in the docs sidebar. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 08:58:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#13512