创建用户跳转码(跳转登录使用)


说明:当一个应用希望跳转到另一个应用时,首先需要创建用户的跳转码
接口地址:/api/oauth2/create-code/
Http请求方式:POST
内容格式:application/json
权限:sso
参数:
参数 参数名 类型 是否必须 说明
authorization type auth_type string 允许的选项为ee_no, user_id, auto_create
organization code org_code string 公司号
employee number ee_no string 员工号,跳转登录使用是,在这个公司下必须唯一
user id user_id int BB系统中的唯一id
redirect client id redirect_client_id string 指定跳转应用的唯一id
next url next string 用户登录后的导向地址
  • 当auth_type为ee_no或者auto_create, org_code 和ee_no是必须的
  • 当auth_type为user_id, user_id是必须的
  • 当auth_type为auto_create,用户不存在时会被自动创建
返回值:
  • code
  • created: 布尔类型,标记是否有新用户创建
  • user_id
  • redirect_url: 跳转登录链接,仅供参考,请以code为准
请求示例:
{
    "auth_type": "auto_create",
    "ee_no":"test001",
    "redirect_client_id": "xB3cQBSUbhbDdqcJGjqFzQ3uWq3J7MyC4krtUJeH",
    "org_code": "test",
"next": "/product?sku=1111"
}
返回示例:
{
    "result_code": "sso_granted",
    "result_message": "sso granted success",
    "result": {
        "redirect_url": "http://localhost:8001/api_login/?code=cF7FOH4BGnm8YFpmW33X5guldKLAIM",
        "code": "cF7FOH4BGnm8YFpmW33X5guldKLAIM",
        "created": true,
        "user_id": 752127
    },
    "success": true
}