登录接入
获取用户切换角色的code
使用场景: 用户切换角色时,获取对应的code。接口参数来源于接口"获取用户所有角色"
请求地址: https://test-oapi.epaas.qq.com/openlogin/user/switch_role?access_token=ACCESS_TOKEN
请求方法: [ GET ]
请求参数:
参数 | 必须 | 说明 |
---|---|---|
access_token | 是 | 调用接口凭证,使用用户态access_token,由/open/access_token获得 |
corpid | 是 | 切换的目标机构id |
userid | 是 | 切换的目标用户id |
role_id | 是 | 切换的目标角色id |
child_id | 否 | 仅家长角色是必填,表明切换到家长关联的某个孩子视角。 |
返回结果:
{
"errcode": 0,
"errmsg": "ok",
"code": "b8a938214e3af4d192291828bb36d42c"
}
参数说明:
参数 | 说明 |
---|---|
errcode | 返回码 |
errmsg | 对返回码的文本描述内容 |
code | 目标角色对应的code |
按端过滤用户角色列表
使用场景: 按端过滤用户角色列表。
请求地址: https://test-oapi.epaas.qq.com/openlogin/user/get_available_roles?access_token=ACCESS_TOKEN
请求方法: [ POST ]
请求包体:
{
"terminal_type":1
}
参数说明:
参数 | 必须 | 说明 |
---|---|---|
access_token | 是 | 调用接口凭证,使用用户态access_token,由/open/access_token获得 |
terminal_type | 是 | 1-pcweb 2-h5 3-小程序 |
返回结果:
{
"errmsg": "ok",
"errcode": 0,
"users": [
{
"userid": "30048858",
"corpid": "894621",
"role_id": 2,
"org_name": "evan沙盒4测试上级单位",
"org_type": 2,
"name": "evan沙盒4",
"child_id": 0,
"child_name": "",
"relation": ""
},
{
"userid": "30048816",
"corpid": "894610",
"role_id": 2,
"org_name": "evan沙盒测试上级单位",
"org_type": 2,
"name": "evan沙盒",
"child_id": 0,
"child_name": "",
"relation": ""
}
]
}
参数说明:
参数 | 说明 |
---|---|
errcode | 返回码 |
errmsg | 对返回码的文本描述内容 |
users | 用户角色列表 |
user.userid | 该角色的UserId |
user.role_id | 角色ID |
user.name | 角色名 |
user.corpid | 机构ID |
user.org_type | 机构类型 |
user.org_name | 机构名 |
user.child_id | 孩子UserId(角色为家长时非空) |
user.child_name | 孩子名(角色为家长时非空) |
user.relation | 关系(角色为家长时非空) |
获取用户所有角色列表
使用场景: 使用用户态token获取用户所有角色列表。
请求地址: https://test-oapi.epaas.qq.com/common/user/role_list?access_token=ACCESS_TOKEN
请求方法: [ GET ]
参数说明:
参数 | 必须 | 说明 |
---|---|---|
access_token | 是 | 调用接口凭证,使用用户态access_token,由/open/access_token获得 |
返回结果:
{
"errmsg": "ok",
"errcode": 0,
"users": [
{
"userid": "30048858",
"corpid": "894621",
"role_id": 2,
"org_name": "evan沙盒4测试上级单位",
"org_type": 2,
"name": "evan沙盒4",
"child_id": 0,
"child_name": "",
"relation": ""
},
{
"userid": "30048816",
"corpid": "894610",
"role_id": 2,
"org_name": "evan沙盒测试上级单位",
"org_type": 2,
"name": "evan沙盒",
"child_id": 0,
"child_name": "",
"relation": ""
}
]
}
参数说明:
参数 | 说明 |
---|---|
errcode | 返回码 |
errmsg | 对返回码的文本描述内容 |
users | 用户角色列表 |
user.userid | 该角色的UserId |
user.role_id | 角色ID |
user.name | 角色名 |
user.corpid | 机构ID |
user.org_type | 机构类型 |
user.org_name | 机构名 |
user.child_id | 孩子UserId(角色为家长时非空) |
user.child_name | 孩子名(角色为家长时非空) |
user.relation | 关系(角色为家长时非空) |