@ easy- cms/ auth- oauth
与 Google, 微软( Entra ID), GitHub 或任何 OpenID 连接供应商( Okta, Keycloak, Auth0...) 一起签名到 Easy CMS 管理员. 部分 简单 CMS,用于 Nuxt 和 Next.js 的嵌入式,代码为第一的无头 CMS.
安装
npm install @easy-cms/auth-oauth
或者说 pnpm add, (中文(简体) ), yarn add 或者说 bun add。 。 。 .
使用量
import { github, google, microsoft, oidc } from '@easy-cms/auth-oauth'
export default defineConfig({
// …
serverURL: 'https://cms.example.com',
auth: {
providers: [
google(), // GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET
// microsoft(), // MICROSOFT_TENANT_ID, MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET
// github(), // GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
// oidc({ id: 'okta', name: 'Okta', issuer: 'https://example.okta.com', clientId, clientSecret }),
],
// allowSignUp: { domains: ['example.com'], role: 'editor' },
},
})
给提供者的重定向(召回) URL 是 <serverURL>/api/cms/auth/<id>/callback,比如说. https://cms.example.com/api/cms/auth/google/callback。 。 。 .
或打开的管理员
signInPlugin() 让管理员打开 Google、 Microsoft、 GitHub 和 OpenID 连接供应商在
设置 · 整合 · 签入,在测试签入后; auth.providers 保留默认值.
import { signInPlugin } from '@easy-cms/auth-oauth'
export default defineConfig({
serverURL: 'https://cms.example.com',
plugins: [signInPlugin()],
})
npx easy-cms reset-sign-in 如果管理员不能签名, 则返回到配置的提供者.
链接
单笔签名 • 妇女 文档 (单位:千美元)ภาษาไทย· GitHub 图像
MIT 许可证