taolib.testing.oauth.providers.base#
OAuth 提供商协议模块。
定义所有 OAuth 提供商必须实现的协议接口。
Classes#
OAuth 提供商协议。 |
Module Contents#
- class taolib.testing.oauth.providers.base.OAuthProviderProtocol#
Bases:
ProtocolOAuth 提供商协议。
所有 OAuth 提供商实现必须遵循此协议接口。
- get_authorize_url(client_id: str, redirect_uri: str, state: str, scopes: list[str]) str#
生成 OAuth 授权 URL。
- 参数:
client_id -- 应用 Client ID
redirect_uri -- 回调 URI
state -- CSRF 防护 state 参数
scopes -- 请求的权限范围
- 返回:
完整的授权 URL
- async exchange_code(code: str, client_id: str, client_secret: str, redirect_uri: str) dict[str, Any]#
用授权码交换 Token。
- 参数:
code -- 授权码
client_id -- 应用 Client ID
client_secret -- 应用 Client Secret
redirect_uri -- 回调 URI
- 返回:
Token 响应字典,包含 access_token、refresh_token、expires_in 等
- async fetch_user_info(access_token: str) taolib.testing.oauth.models.profile.OAuthUserInfo#
获取用户信息。
- 参数:
access_token -- 访问令牌
- 返回:
标准化的用户信息