文档
测试

【过时】1.1 登录-管理员

POST
/oauth/token

接口描述

用于管理员账号登录

请求参数-POST-表单

参数名
类型
描述
必填
grant_type
string
登录方式
必填
client_id
string
登录方式
必填
client_secret
string
登录方式
必填
username
string
部门代码
必填
password
string
密码
必填
type
string
类型
必填
client
string
admin
必填
mobile
string
手机号
必填
code
string
验证码
必填

响应参数-JSON

参数名
类型
描述
必填
code
int
1000:多个clusterCode,1001:clusterCode错误,1002:其他错误,1004:用户不存在
必填
message
string
描述
必填

说明 / 示例

- - 当error_description==2001时,需要输入验证码 - ## 情况一 只有一个部门编号时:用户输入手机号点登录 ```json req: http://192.168.1.167:7001/oauth/token 参数: grant_type:password password:123456 type:baec client:admin mobile:13521679354 返回值示例一:弹出验证码 此种情况需要发送验证码,加上code字段、clusterCode、username之后才可以登录。其中: code:验证码 clusterCode:邀请码(从返回值获取) username:部门编号(从返回值获取) { "cluster_code": "TEST0525", "success": false, "code": 1002, "company_code": "B02", "message": "登陆sso返回错误信息", "error_description": "2001", "error": "unauthorized" } 返回值示例二:成功登录 { "cluster_code": "TEST0525", "scope": "all", "refresh_token": "18de6b50-991b-41ee-a86f-32022052d7a2", "token_type": "bearer", "access_token": "fb45e56b-c06c-4212-bffe-b501148f451b", "code": 200, "sso_url": "http://39.102.45.111:9000/sso", "expires_in": 70969682, "server_url": "http://39.102.45.111:9000/server" } ``` ## 情况二 输入手机号,登录返回多个邀请码 ### 步骤一,返回多个邀请码或部门编码 ```json req: http://192.168.1.167:7001/oauth/token 参数: grant_type:password password:123456 type:baec client:admin mobile:13521679354 返回值示例: { "message": "用户存在多个邀请码", "cluster_codes": [ { "name": "腾少", "cluster_code": "TENG", "company_code": [ "B29" ] }, { "cluster_code": "TEST001", "name": "北京市教委环境-TEST", "company_code": [ "A01" ] }, { "name": "测试-TEST0525", "cluster_code": "TEST0525", "company_code": [ "B01", "B02", "B4" ] } ], "code": 1000 } ``` ### 步骤二,使用部门编码登录 ```json req: http://192.168.1.167:7001/oauth/token 参数: grant_type:password username:B29 password:123456 clusterCode:TEST0525 type:baec client:admin mobile:15701208736 返回值示例一: { "cluster_code": "TEST0525", "success": false, "code": 1002, "company_code": "B02", "message": "登陆sso返回错误信息", "error_description": "2001", "error": "unauthorized" } 返回值示例二: { "cluster_code": "TEST0525", "scope": "all", "refresh_token": "18de6b50-991b-41ee-a86f-32022052d7a2", "token_type": "bearer", "access_token": "fb45e56b-c06c-4212-bffe-b501148f451b", "code": 200, "sso_url": "http://39.102.45.111:9000/sso", "expires_in": 70969682, "server_url": "http://39.102.45.111:9000/server" } ```