webiny-configure-entraid
它能做什么
这个技能指导你的 AI 通过 Cognito 为 Webiny 项目添加 Microsoft Entra ID 登录。适用于希望团队使用 Microsoft 登录的开发者。
适用场景
- ✓希望团队成员使用其 Microsoft 账号登录 Webiny 的时候。
- ✓需要为 Webiny 设置 Entra ID 或 Azure AD 应用的时候。
- ✓需要 Microsoft 登录所用的 tenant ID 和 issuer 网址的时候。
技能链接
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/configure-entraid/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我用 Entra ID 为我们的公司租户设置 Webiny 管理后台的 Microsoft 登录。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能列出了在 Microsoft Entra 管理中心注册应用并获取客户端 ID、客户端密钥和租户 ID 的步骤。然后讲解在配置文件中为 Cognito 扩展添加联合设置。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Configure Microsoft Entra ID Authentication
TL;DR
Webiny supports Microsoft Entra ID (formerly Azure AD) as a federated identity provider through Cognito Federation. Unlike Okta or Auth0 which replace Cognito entirely, Entra ID works alongside Cognito — users authenticate via Microsoft, but Cognito remains the user pool. Configure it by adding federation to the <Cognito /> extension in webiny.config.tsx with your Entra ID application's client ID, client secret, and issuer URL.
Prerequisites
Before configuring Webiny, you need to register an application in the Microsoft Entra ID portal:
- Go to Microsoft Entra admin center > App registrations > New registration
- Set a name (e.g., "Webiny Admin")
- Set Supported account types (typically "Accounts in this organizational directory only")
- Set Redirect URI: Web — use your Cognito domain callback URL (you'll get this after the first deploy:
https://{domain}.auth.{region}.amazoncognito.com/oauth2/idpresponse) - After registration, note:
- Application (client) ID — this is your
client_id - Directory (tenant) ID — part of your issuer URL
- Application (client) ID — this is your
- Go to Certificates & secrets > New client secret — note the Value (this is your
client_secret) - The Issuer URL is:
https://login.microsoftonline.com/{tenant-id}/v2.0
Reference Tables
Required Entra ID Values
| Value | Where to find it | Used as |
|---|---|---|
| Application (client) ID | App registration > Overview | client_id in providerDetails |
| Client secret value | App registration > Certificates & secrets | client_secret in providerDetails |
| Directory (tenant) ID | App registration > Overview | Part of oidc_issuer URL |
Environment Variables
| Variable | Description |
|---|---|
ENTRA_CLIENT_ID |
Entra ID Application (client) ID |
ENTRA_CLIENT_SECRET |
Entra ID client secret value |
ENTRA_ISSUER |
https://login.microsoftonline.com/{tenant-id}/v2.0 |
Attribute Mapping
When Cognito receives tokens from Entra ID, it maps the OIDC claims to Cognito user attributes. The default OIDC mapping is:
| Cognito Attribute | OIDC Claim | Description |
|---|---|---|
username |
sub |
Unique user identifier |
custom:id |
sub |
Webiny internal user ID |
email |
email |
User's email address |
given_name |
given_name |
First name |
family_name |
family_name |
Last name |
preferred_username |
email |
Used as the Cognito username alias |
You can override this mapping with the attributeMapping property on the identity provider config. This is useful when:
- Your Entra ID uses non-standard claim names
- You want to skip
custom:idmapping (e.g., when thesubvalue exceeds the attribute's max length on existing pools) - You need to map additional custom attributes
{
name: "EntraID",
type: "oidc",
label: "Sign in with Microsoft",
providerDetails: { /* ... */ },
attributeMapping: {
username: "sub",
email: "email",
given_name: "given_name",
family_name: "family_name",
preferred_username: "email"
// custom:id intentionally omitted
}
}
When attributeMapping is provided, it replaces the defaults entirely — include all mappings you need.
Full Examples
Example 1: Basic Entra ID Federation
Step 1: Set environment variables
Add to your .env file:
# NOTE: these are made up example values
ENTRA_CLIENT_ID=f62ee823-2811-8314-a040-62848442c0d5
ENTRA_CLIENT_SECRET=~Gp7Q~97MAzTAUyeTLzTVzX31DRTY28chehU6c_a
ENTRA_ISSUER=https://login.microsoftonline.com/1cd0d912-0ac4-48a0-91b6-cd849ce9498f/v2.0
Step 2: Create the extension
Create extensions/entraid/Extension.tsx:
import React from "react";
import { Co
常见问题
Entra ID 会替换 Cognito 吗?
不会。该技能说明它与 Cognito 配合使用,Cognito 仍是用户池。
我需要从微软门户获取什么?
应用的客户端 ID、客户端密钥的值,以及目录租户 ID。
issuer 网址是什么样的?
它遵循微软登录域名的格式,包含租户 ID 和 v2.0 路径。
详情
作者的原始描述
Configuring Microsoft Entra ID (formerly Azure AD) as a federated identity provider for Webiny projects using Cognito Federation. Use this skill when the developer asks about Entra ID, Azure AD, Microsoft SSO, OIDC with Microsoft, Microsoft login for Webiny, or configuring login.microsoftonline.com as an identity provider. Also relevant for tenant IDs, Entra application registration, or connecting Microsoft 365 accounts to Webiny.
repo: webiny/webiny-js
热度
- GitHub 星标
- 8.1k
- 排名
- #12596
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
prd-to-plan
8.1k帮你的智能体把产品需求文档转化为分阶段的计划,由许多小的端到端切片组成,并保存为 Markdown 文件。
webiny-admin-architect
8.1k教你的智能体如何为 Webiny 平台构建管理界面,使用其业务逻辑层和呈现器模式。
webiny-admin-permissions
8.1k教你的智能体为 Webiny 管理界面添加权限控制,包括自动生成的权限表单以及显示或隐藏检查。
webiny-form-model
8.1k教你的智能体使用声明式字段构建器、布局、校验和条件规则,在 Webiny 中构建表单。