UserInfo¶
OpenID Connect UserInfo endpoint (OIDC Core 1.0 Section 5.3).
Request / Response Models¶
UserInfoRequest(address, token, expected_sub=None, dpop_key=None, mtls=None)
dataclass
¶
Bases: BaseRequest
Request for the OpenID Connect UserInfo endpoint.
Attributes:
| Name | Type | Description |
|---|---|---|
address |
str
|
The UserInfo endpoint URL. |
token |
str
|
A valid access token with |
expected_sub |
str | None
|
Expected |
dpop_key |
DPoPKey | None
|
When set, the UserInfo request is DPoP-bound (RFC 9449): the
access token is presented with |
mtls |
MtlsClientAuth | None
|
When set, the UserInfo/resource request presents this client certificate at the TLS layer (RFC 8705) — required to use an mTLS certificate-bound access token at the resource server. |
UserInfoResponse(is_successful, error=None, claims=None, raw=None)
dataclass
¶
Bases: BaseResponse
Response from the UserInfo endpoint.
Check is_successful before accessing claims or raw.
Sync API¶
get_userinfo(request, http_client=None)
¶
Get claims about an authenticated user from the UserInfo endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
UserInfoRequest
|
UserInfo request with endpoint address and access token |
required |
http_client
|
HTTPClient | None
|
Optional managed HTTP client. When |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
UserInfoResponse |
UserInfoResponse
|
Response with claims (JSON) or raw JWT string |
Async API¶
get_userinfo(request, http_client=None)
async
¶
Get claims about an authenticated user from the UserInfo endpoint (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
UserInfoRequest
|
UserInfo request with endpoint address and access token |
required |
http_client
|
AsyncHTTPClient | None
|
Optional managed HTTP client. When |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
UserInfoResponse |
UserInfoResponse
|
Response with claims (JSON) or raw JWT string |