GET /oauth/userinfo

OpenID Connect UserInfo 端点。使用 Bearer Token 认证,返回扁平 UserInfo JSON(无 code/message 信封)。当 scope 包含 "profile" 时,从 profile-service 查询用户资料并合并到响应中。当配置了 verification-service 时,额外查询年龄分组/未成年人状态。参考:OpenID Connect Core 1.0 §5.3 (UserInfo Endpoint)。

OAuth None application/json

请求参数

名称位置类型必填默认值示例约束描述
Authorization header string 是 Bearer <access_token>

响应

状态描述Schema
200UserInfo 响应(含 sub, name, email, picture 等 OIDC 标准声明)service-oauth/internal/handler/dto.OIDCUserInfoResponse
401invalid_token:Token 无效或已过期。参考:OIDC Core §5.3。service-oauth/internal/handler/dto.OAuthErrorResponse

引用的 Schema

service-oauth/internal/handler/dto.OAuthErrorResponse

OAuth标准错误响应

字段类型必填示例约束描述
error string 否 invalid_request 错误码
error_description string 否 Missing required parameter 错误描述
error_uri string 否 https://docs.example.com/errors 错误URI
i18n_key string 否 error.oauth_invalid_request I18nKey 本地化键(AUTH-46①/U416):协议字段 error/error_description 保持 RFC 6749 §5.2 原样, 本字段是**附加**信息(omitempty;未知错误码不填),供前端/AI 客户端按键确定性渲染文案, 无需解析英文原文。仅出现在 JSON 错误体,不写入 302 错误重定向的查询串。
state string 否 state-123 状态

service-oauth/internal/handler/dto.OIDCUserInfoResponse

字段类型必填示例约束描述
age_group string 否
birthdate string 否 1990-01-15
client_id string 否 app-123 Internal
email string 否 user@example.com Email Claims(scope=email 时填充;真源 = identity 的邮箱身份与验证状态)
email_verified boolean 否 True
family_name string 否 Doe
gender string 否 male
given_name string 否 John
is_minor boolean 否 Verification (age/minor status)
locale string 否 en-US
name string 否 John Doe OIDC Standard Claims(可选,scope=profile 时填充)
nickname string 否 Johnny
picture string 否 https://cdn.example.com/avatars/usr_abc123.jpg
preferred_username string 否 john
scope string 否 openid profile
sub string 否 usr_abc123 用户ID(必填)
updated_at integer 否 1743728400
website string 否 https://johndoe.com
zoneinfo string 否 America/Los_Angeles