providers/zitadel
ZitadelProfile
使用配置文件回调时,从 ZITADEL 返回的用户配置文件。查看标准声明参考 这里。如果您需要访问 ZITADEL API 或需要其他信息,请确保添加相应的范围。
扩展
Record<string,any>
属性
amr
amr: string;aud
aud: string;auth_time
auth_time: number;azp
azp: string;email: string;email_verified
email_verified: boolean;exp
exp: number;family_name
family_name: string;gender
gender: string;given_name
given_name: string;iat
iat: number;iss
iss: string;jti
jti: string;locale
locale: string;name
name: string;nbf
nbf: number;phone
phone: string;phone_verified
phone_verified: boolean;picture
picture: string;preferred_username
preferred_username: string;sub
sub: string;default()
default<P>(options): OIDCConfig<P>将 ZITADEL 登录添加到您的页面。
设置
回调 URL
https://example.com/api/auth/callback/zitadel配置
import { Auth } from "@auth/core"
import ZITADEL from "@auth/core/providers/zitadel"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
ZITADEL({
clientId: ZITADEL_CLIENT_ID,
clientSecret: ZITADEL_CLIENT_SECRET,
}),
],
})资源
备注
默认情况下,Auth.js 假设 ZITADEL 提供商基于 Open ID Connect 规范。
创建凭据时使用的重定向 URI 必须包含您的完整域名,并以回调路径结尾。例如
- 对于生产环境:
https://{YOUR_DOMAIN}/api/auth/callback/zitadel - 对于开发环境:
https://:3000/api/auth/callback/zitadel
确保在 ZITADEL 控制台中启用开发模式以允许本地开发的重定向。
💡
ZITADEL 提供商附带一个 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供商。
💡
ZITADEL 还返回配置文件中的 email_verified 布尔属性。您可以使用此属性来限制对已验证帐户用户的访问。
const options = {
...
callbacks: {
async signIn({ account, profile }) {
if (account.provider === "zitadel") {
return profile.email_verified;
}
return true; // Do different verification for other providers that don't have `email_verified`
},
}
...
}类型参数
| 类型参数 |
|---|
P extends ZitadelProfile |
参数
| 参数 | 类型 |
|---|---|
options | OAuthUserConfig<P> |
返回值
OIDCConfig<P>