POST /admin/oauth/providers

创建一个新的OAuth提供商配置,包括名称、Client ID、Client Secret、授权/令牌/用户信息端点URL等信息。仅管理员可访问。

OAuth `bearerAuth` application/json

请求体

Schema: service-oauth/internal/handler/dto.AdminCreateProviderRequest

字段类型必填示例约束描述
client_id string 是
client_secret string 是
name string 是
auth_url string 否
display_name string 否
enabled boolean 否 Enabled 缺省(不传)= true,保持既有 API 行为;显式 false 才创建为禁用。
redirect_url string 否
scopes string 否
token_url string 否
user_info_url string 否

响应

状态描述Schema
201创建的提供商信息dto.DataResponse-service-oauth/internal/handler/dto/OAuthProviderItem
400请求参数错误service-core/base/dto.SimpleResponse
401未认证:请提供有效的 Bearer Tokenservice-core/base/dto.SimpleResponse
403权限不足:需要管理员权限service-core/base/dto.SimpleResponse
409冲突:提供商名称已存在service-core/base/dto.SimpleResponse
500服务内部错误service-core/base/dto.SimpleResponse

引用的 Schema

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

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

service-core/base/dto.SimpleResponse

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

service-oauth/internal/handler/dto.OAuthProviderItem

字段类型必填示例约束描述
auth_url string 否 https://github.com/login/oauth/authorize
client_id string 否 client-id
created_at string 否 2026-04-15T10:30:00Z
display_name string 否 GitHub
enabled boolean 否 True
id string 否 prov_abc123
name string 否 github
redirect_url string 否 https://app.example.com/callback
scopes array of

string

否 ['["read:user"', '"user:email"]']
tenant_id string 否 tenant_abc123
token_url string 否 https://github.com/login/oauth/access_token
updated_at string 否 2026-04-15T10:30:00Z
user_info_url string 否 https://api.github.com/user