providers/keycloak
KeycloakProfile
繼承
Record
<string
,any
>
屬性
acr
acr: string;
at_hash
at_hash: 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;
given_name
given_name: string;
iat
iat: number;
iss
iss: string;
jti
jti: string;
name
name: string;
picture
picture: string;
preferred_username
preferred_username: string;
session_state
session_state: string;
sid
sid: string;
sub
sub: string;
typ
typ: string;
user
user: any;
default()
default<P>(options): OAuthConfig<P>
將 Keycloak 登入新增至您的頁面。
設定
回調 URL
https://example.com/api/auth/callback/keycloak
設定
import { Auth } from "@auth/core"
import Keycloak from "@auth/core/providers/keycloak"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
Keycloak({
clientId: KEYCLOAK_CLIENT_ID,
clientSecret: KEYCLOAK_CLIENT_SECRET,
issuer: KEYCLOAK_ISSUER,
}),
],
})
資源
💡
在 Keycloak 中建立一個 openid-connect 用戶端,並將「存取類型」設為「機密」。
issuer 應包含領域 — 例如 https://my-keycloak-domain.com/realms/My_Realm
注意事項
預設情況下,Auth.js 假設 Keycloak 提供者基於 Open ID Connect 規範。
💡
Keycloak 提供者帶有預設設定。若要覆寫您的使用案例的預設值,請查看自訂內建的 OAuth 提供者。
類型參數
類型參數 |
---|
P extends KeycloakProfile |
參數
參數 | 類型 |
---|---|
options | OAuthUserConfig <P > |
返回
OAuthConfig
<P
>