GET /oauth/{provider}/callback

第三方 OAuth 提供商授权完成后的回调端点。交换授权码获取访问令牌并拉取用户信息。

OAuth None application/json

请求参数

名称位置类型必填默认值示例约束描述
provider path string 是 提供商名称
code query string 是 第三方返回的授权码
state query string 是 签名后的 state 参数

响应

状态描述Schema
200回调处理结果(含脱敏 token 和用户信息)dto.DataResponse-service-oauth/internal/handler/dto/OAuthCallbackResponse
400缺少 code 或 state 无效service-core/base/dto.SimpleResponse
404不支持的提供商service-core/base/dto.SimpleResponse
500交换授权码或获取用户信息失败service-core/base/dto.SimpleResponse

引用的 Schema

dto.DataResponse-service-oauth/internal/handler/dto/OAuthCallbackResponse

字段类型必填示例约束描述
code integer 否
data service-oauth/internal/handler/dto.OAuthCallbackResponse 否
message string 否
timestamp string 否

service-core/base/dto.SimpleResponse

字段类型必填示例约束描述
code integer 否
message string 否
timestamp string 否

service-oauth/internal/handler/dto.OAuthCallbackResponse

OAuth授权回调结果

字段类型必填示例约束描述
provider string 否 github 提供商
state string 否 state-123 状态
token string 否 gho_abc1... 令牌(已脱敏)
user_info object 否 extra keys: `string` 用户信息