You need to enable JavaScript to run this app.
导航

CreateOAuthProvider - 创建 OAuth 身份提供商

最近更新时间2024.02.23 13:58:52

首次发布时间2024.02.23 13:58:52

创建 OAuth 身份提供商

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

CreateOAuthProvider

要执行的操作,取值:CreateOAuthProvider

Version
String

2018-01-01

API的版本,取值:2018-01-01

OAuthProviderName
String

my-provider

OAuth 身份提供商名称

SSOType
Integer

身份提供商 SSO 类型

  1. 角色 SSO(暂不支持)
  2. 用户 SSO
Status
Integer

身份提供商状态 (仅用户 SSO)

  1. 开启
  2. 开启并禁用其他登录方式
  3. 关闭
Description
String

身份提供商描述

ClientId
String

OAuth 应用 Client Id

ClientSecret
String

OAuth 授权应用秘钥

UserInfoURL
String

https://example.com/oauth/user_info

OAuth 授权服务用户信息端点地址

TokenURL
String

https://example.com/oauth/access_token

OAuth 授权服务 AccessToken 端点地址

AuthorizeURL
String

https://example.com/oauth/authorize

OAuth 授权服务授权地址

AuthorizeTemplate
String

${authEndpoint}?client_id=${clientId}&scope=${scope}&response_type=code&state=xxxxx

OAuth 授权地址访问模板

Scope
String

OAuth 授权服务范围,多个使用空格连接

IdentityMapType
Integer

OAuth 用户信息映射子用户方式

  1. 映射子用户名称
  2. 映射子用户安全手机
IdpIdentityKey
String

username

OAauth 用户信息映射字段

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
Trn
String

trn:iam::2100000000:saml-provider/my-provider

身份提供商 Trn

OAuthProviderName
String

my-provider

OAuth 身份提供商名称

SSOType
Integer

身份提供商 SSO 类型

  1. 角色 SSO
  2. 用户 SSO
Status
Integer

身份提供商状态 (仅用户 SSO)

  1. 开启
  2. 开启并禁用其他登录方式
  3. 关闭
CreateDate
String

2024-01-03T16:10:57+08:00

创建时间

UpdateDate
String

2024-01-03T16:10:57+08:00

更新时间

Description
String

身份提供商描述

请求示例

POST '/?Action=CreateOAuthProvider&Version=2018-01-01' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'OAuthProviderName=oauth' \
--data-urlencode 'ClientSecret=******' \
--data-urlencode 'AuthorizeURL=https://example.com/authorize' \
--data-urlencode 'TokenURL=https://example.com/access_token' \
--data-urlencode 'UserInfoURL=https://example.com/user_info' \
--data-urlencode 'Scope=openid' \
--data-urlencode 'AuthorizeTemplate=${authEndpoint}?client_id=${clientId}&scope=${scope}&response_type=code&state=12345' \
--data-urlencode 'IdentityMapType=1' \
--data-urlencode 'IdpIdentityKey=username' \
--data-urlencode 'Description=test' \
--data-urlencode 'Status=1'

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20240103173223FDAB2959D808FEBB7F70",
        "Action": "CreateOAuthProvider",
        "Version": "2018-01-01",
        "Service": "iam",
        "Region": "cn-north-1"
    },
    "Result": {
        "Trn": "trn:iam::2100000000:oauth-provider/oauth",
        "OAuthProviderName": "oauth",
        "Description": "",
        "SSOType": 2,
        "Status": 1,
        "CreateDate": "2023-06-05T14:43:31+08:00",
        "UpdateDate": "2024-01-03T17:32:25+08:00"
    }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

HttpCode
错误码
错误信息
说明
400
SensitiveWord.OAuthProviderName
Sensitive word in OAuth Provider Name.

身份提供商名称不符合规定,请修改后重试

400
InvalidParameter.DuplicateProviderName
The OAuth Provider does already EXIST.

身份提供商名称已存在,请更换后重试

400
InvalidParameter
The specified parameter is invalid

接口参数不合法