USERINFO 端点
/oauth2/userInfo
终端节点将返回有关经过身份验证的用户的信息。
GET /oauth2/userInfo
用户池客户端直接对此终端节点发出请求,而不通过浏览器。
有关更多信息,请参阅 OpenID Connect (OIDC) 规范中的 UserInfo 端点
标头中的请求参数
- Authorization: Bearer
<access_token>
-
使用授权标头字段传递访问令牌。
必填项。
示例请求
GET https://
<your-user-pool-domain>
/oauth2/userInfo Authorization: Bearer<access_token>
示例正向响应
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 { "sub": "248289761001", "name": "Jane Doe", "given_name": "Jane", "family_name": "Doe", "preferred_username": "j.doe", "email": "janedoe@example.com" }
有关 OIDC 声明的列表,请参阅标准声明
示例负向响应
请求无效
HTTP/1.1 400 Bad Request
WWW-Authenticate: error="invalid_request",
error_description="Bad OAuth2 request at UserInfo Endpoint"
- invalid_request
-
请求缺少必需的参数、包括不支持的参数值或者格式错误。
令牌无效
HTTP/1.1 401 Unauthorized
WWW-Authenticate: error="invalid_token",
error_description="Access token is expired, disabled, or deleted, or the user has globally signed out."
- invalid_token
-
访问令牌已过期、已撤销、格式不正确或无效。