OIDC Claims

授权请求通过 scope 申请权限。UserInfo 与 ID Token 中的声明按 access token 实际授予的 scope 过滤返回。

UserInfo 端点: 推荐 https://login.heanbian.com/userinfo; 兼容 https://login.heanbian.com/oauth2/userinfo。 请求头:Authorization: Bearer <access_token>。

可申请 Scope

Scope 推荐 说明 常见声明(Claims)
openid 是 启用 OIDC,获取 ID Token 与主体标识 sub
profile 是 基本资料 name, nickname, picture, preferred_username
email 是 邮箱相关声明 email, email_verified
phone 否 手机号相关声明 phone_number, phone_number_verified

使用约定

  • OIDC 登录必须包含 openid,否则不会签发 ID Token。
  • 推荐最小集合:openid profile email。
  • phone 为可选;仅在业务确需手机号时申请。
  • sub 为稳定主体标识,请勿将可变字段(如昵称)当作主键。

ID Token 与 UserInfo

来源 用途 校验要点
ID Token 认证结果(谁登录) iss、aud、exp;签名密钥见 JWKS
UserInfo 用户资料(按 scope) 需有效 access_token;用户停用/注销后将拒绝

JWKS:https://login.heanbian.com/oauth2/jwks

机读接口

GET /api/v1/integration/scopes
curl https://login.heanbian.com/api/v1/integration/scopes