webiny-configure-okta
它能做什么
这个技能指导你的 AI 为 Webiny 项目设置 Okta 作为登录服务商。适用于公司使用 Okta 做单点登录的开发者。
适用场景
- ✓希望用 Okta 取代 Cognito 登录 Webiny 项目的时候。
- ✓需要将 Okta 令牌声明映射到 Webiny 身份数据的时候。
- ✓需要设置 Okta issuer 和客户端 ID 环境变量的时候。
技能链接
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/configure-okta/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我把 Webiny 项目切换为 Okta 登录,并映射 Okta 令牌中的邮箱声明。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能讲解了安装 Okta 包、编写映射令牌声明的配置类,并在配置文件中添加 Okta 扩展组件。部署前需要将 issuer 和客户端 ID 设置为环境变量。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Configure Okta Authentication
TL;DR
Webiny supports Okta as an external identity provider (IDP) to replace the default Cognito authentication. First, install the @webiny/okta package (using the same version as the webiny dependency in package.json). Then create two files: an API config class that maps Okta JWT claims to Webiny identity data (OktaIdpConfig), and a React extension component (<Okta />) that wires issuer URL, client ID, and the API config path. Register the extension in webiny.config.tsx, set two environment variables (OKTA_ISSUER, OKTA_CLIENT_ID), and deploy.
Pattern / Core Concept
Okta integration has two parts:
- API Config — A class implementing
OktaIdpConfig.Interfacethat maps JWT token claims to Webiny's identity structure. Registered viaOktaIdpConfig.createImplementation()(the universal DI pattern). - Extension Component — A React component that renders
<Okta />from@webiny/okta, passing the issuer URL, client ID, and path to the API config file. The<Okta />component handles environment variable injection, API extension registration, and Admin login screen setup automatically.
How <Okta /> Works Internally
The <Okta /> component (from @webiny/okta) is a defineExtension that:
- Sets Lambda env vars:
OKTA_ISSUER,OKTA_CLIENT_ID - Sets Admin app env vars:
REACT_APP_IDP_TYPE=okta,REACT_APP_OKTA_ISSUER,REACT_APP_OKTA_CLIENT_ID - Registers the internal
OktaIdpFeatureAPI extension (OIDC token verification) - Registers your custom API config extension (identity mapping)
- Registers the Admin Okta login screen extension
Reference Tables
OktaIdpConfig.Interface
| Method | Signature | Required | Description |
|---|---|---|---|
getIdentity |
(token: JwtPayload) => OktaIdentity | Promise<OktaIdentity> |
Yes | Maps JWT claims to Webiny identity data |
verifyTokenClaims |
(token: JwtPayload) => void | Promise<void> |
No | Custom claim verification (throw to reject the token) |
OktaIdentity (Return Type of getIdentity)
| Field | Type | Description |
|---|---|---|
id |
string |
Unique user ID (typically token["sub"]) |
displayName |
string |
User's display name |
roles |
string[] |
Webiny security roles to assign |
teams |
string[] |
Webiny teams (optional, filter out falsy values) |
profile |
{ firstName, lastName, email } |
User profile fields |
context |
object |
Runtime data (not stored in DB) |
<Okta /> Component Props
| Prop | Type | Description |
|---|---|---|
issuer |
string |
Okta issuer URL (e.g., https://dev-xxx.okta.com) |
clientId |
string |
Okta application client ID |
apiConfig |
string |
Absolute path to the API config file |
Environment Variables
| Variable | Used By | Description |
|---|---|---|
OKTA_ISSUER |
API + Admin | Okta issuer URL |
OKTA_CLIENT_ID |
API + Admin | Okta application client ID |
Full Examples
Example 1: Basic Okta Configuration
Step 0: Install the @webiny/okta dependency
@webiny/okta is an optional dependency. Add it to package.json using the same version as the webiny dependency, then install:
# Check the webiny version in package.json, then add @webiny/okta with the same version
# For example, if "webiny": "^0.0.0-unstable.xxx":
yarn add @webiny/okta@^0.0.0-unstable.xxx
Important: After adding the dependency, tell the user to run
yarnto install it. Do NOT runyarnautomatically — let the user do it.
常见问题
使用哪些环境变量?
OKTA_ISSUER 和 OKTA_CLIENT_ID。
Okta 会替换 Cognito 吗?
是的。该技能将 Okta 描述为默认 Cognito 身份验证的替代方案。
登录流程可以自定义吗?
可以。该技能提到可以自定义 Okta 登录流程。
详情
作者的原始描述
Configuring Okta as an identity provider (IDP) for Webiny projects. Use this skill when the developer asks about Okta authentication, Okta SSO, replacing Cognito with Okta, setting up external identity providers, configuring OIDC authentication, mapping JWT claims to Webiny identities, or customizing the Okta login flow. Also relevant when asking about OKTA_ISSUER, OKTA_CLIENT_ID environment variables, OktaIdpConfig, or the MyOktaExtension pattern.
repo: webiny/webiny-js
热度
- GitHub 星标
- 8.1k
- 排名
- #12597
- 许可证
- —
- 更新时间
- 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 中构建表单。