认证授权

在请求其他所有接口前,应该先通过获取access_token接口取得访问令牌token,然后在请求其他接口的 HTTP Header 中设置Authorization: <token 由 tokenType + accessToken 拼接的字符串>,例如:Authorization: bearer7473e16f-5276-4467-9440-6e6f0eaa4896。

获取 access_token 接口需要的账号、企业号、密码由云盯预先分配。

获取 access_token

接口描述: 用户登录接口,用户需要传入企业号、用户名和密码,成功登录后,系统会返回登录令牌,即token,以供调用其他接口时作为用户授权信息

接口地址: https://yd.yunding360.com/openapi/oauth/token

请求方式:POST

请求示例:

{
    "account": "",
    "enterpriseCode": "",
    "password": ""
}

请求参数:

参数名称 参数说明 in 是否必须 数据类型 schema
login login body true 登录参数 登录参数

schema属性说明

登录参数

参数名称 参数说明 in 是否必须 数据类型 schema
account 账号 body true string
enterpriseCode 企业号 body true string
password 密码 body true string

响应示例:

{
    "accessToken": "",
    "tokenType": "bearer",
    "refreshToken": "",
    "expiresIn": "",
    "refreshTokenExpiresIn": "",
    "scope": "",
    "nickname": "",
    "account": "",
    "userId": "",
    "originalId": "",
    "enterprise": {
        "id": "",
        "code": "",
        "name": "",
        "tradeCode": "",
        "uuid": ""
    }
}

响应参数:

参数名称 参数说明 类型 schema
accessToken 认证令牌 string
account 账号 string
expiresIn 令牌过期时间 string
nickname 用户昵称 string
refreshToken 刷新令牌凭证 string
refreshTokenExpiresIn 刷新令牌过期时间 string
scope 范围 string
tokenType 令牌类型 string
userId 用户Id string(uuid) string(uuid)
originalId 用户原始id string string
enterprise 企业信息 企业信息 enterprise

schema属性说明

企业信息

参数名称 参数说明 类型 schema
uuid 企业uuid string(uuid) string(uuid)
id 企业id string(uuid) string(uuid)
code 企业号 string string
name 企业名称 string string
tradeCode 行业编号 string string

响应状态:

状态码 说明 schema
200 OK 登录凭证

刷新 access_token

接口描述: 因为refreshToken时效性较长,可以使用refreshToken刷新Token凭证,重置Token,不用再使用授权流程获取Token

接口地址: https://yd.yunding360.com/openapi/oauth/token/{refreshToken}

请求方式:POST

请求参数:

参数名称 参数说明 in 是否必须 数据类型 schema
refreshToken 刷新Token凭证 path true string

响应示例:

{
    "accessToken": "",
    "tokenType": "bearer",
    "refreshToken": "",
    "expiresIn": "",
    "refreshTokenExpiresIn": "",
    "scope": "",
    "nickname": "",
    "account": "",
    "userId": "",
    "originalId": "",
    "enterprise": {
        "id": "",
        "code": "",
        "name": "",
        "tradeCode": "",
        "uuid": ""
    }
}

响应参数:

参数名称 参数说明 类型 schema
accessToken 认证令牌 string
account 账号 string
expiresIn 令牌过期时间 string
nickname 用户昵称 string
refreshToken 刷新令牌凭证 string
refreshTokenExpiresIn 刷新令牌过期时间 string
scope 范围 string
tokenType 令牌类型 string
userId 用户Id string(uuid) string(uuid)
originalId 用户原始id string string
enterprise 企业信息 企业信息 enterprise

schema属性说明

企业信息

参数名称 参数说明 类型 schema
uuid 企业uuid string(uuid) string(uuid)
id 企业id string(uuid) string(uuid)
code 企业号 string string
name 企业名称 string string
tradeCode 行业编号 string string

响应状态:

状态码 说明 schema
200 OK 登录凭证

注销 access_token

接口描述: 用户登出,注销用户当前Token

接口地址: https://yd.yunding360.com/openapi/oauth/token/{token}

请求方式:DELETE

请求参数:

参数名称 参数说明 in 是否必须 数据类型 schema
token Token path true string

响应示例:


响应参数:

暂无

响应状态:

状态码 说明 schema
200 OK