应用授权类接口

第三方应用授权流程图

sequenceDiagram participant manager as 学校管理员 participant app as 应用 participant qywx_app_manager as Token托管服务 participant notify_change as 回调消息通知 manager ->> qywx_app_manager: 安装应用 qywx_app_manager ->> notify_change: 调用notify_change下发auth_code notify_change -->> app: 推送auth_code app ->> app: 缓存auth_code app ->> notify_change: 返回success app ->> qywx_app_manager: 通过auth_code,suite_access_token获取permanent_code qywx_app_manager -->> app: 返回permanent_code app ->> app: 存储permanent_code到db app ->> qywx_app_manager: 通过permanent_code获取corp_access_token qywx_app_manager -->> app: 返回corp_access_token

获取第三方应用凭证(suite_access_token)

请求地址https://test-oapi.epaas.qq.com/service/get_suite_token

请求方式:HTTP POST

请求包体

{
    "suite_id":"wwddddccc7775555aaa" ,
    "suite_secret": "ldAE_H9anCRN21GKXVfdAAAAAAAAAAAAAAAAAA", 
    "suite_ticket": "Cfp0_givEagXcYJIztF6sfbdmIZCmpaR8ZBsvJEFFNBrWmnD5-CGYJ3_NhYexMyw" 
}

请求参数

参数 是否必须 说明
suite_id 应用 SuiteId
suite_secret 应用 SuiteKey
suite_ticket 教育号定时推送的 ticket

返回结果

{
    "errcode":0 ,
    "errmsg":"ok" ,
    "suite_access_token":"61W3mEpU66027wgNZ_MhGHNQDHnFATkDa9-2llMBjUwxRSNPbVsMmyD-yq8wZETSoE5NQgecigDrSHkPtIYA",
    "expires_in":7200
}

参数说明

参数 说明
suite_access_token 第三方应用 access_token, 最长为512字节, 详细介绍请前往接口调用凭证
expires_in 有效期(s)

获取永久授权码(permanent_code)

请求方式:POST (HTTPS)

请求地址https://test-oapi.epaas.qq.com/service/get_permanent_code?suite_access_token=SUITE_ACCESS_TOKEN

请求包体

{
    "auth_code": "auth_code_value"
}

参数说明

参数 是否说明 说明
auth_code 临时授权码,会在授权成功时附加在redirect_uri中跳转回第三方服务商网站,或通过授权成功通知回调推送给服务商。长度为64至512个字节

返回结果

{
    "errcode":0 ,
    "errmsg":"ok" ,
    "permanent_code": "xxxx",
    "corpid":"234",
    "agentid":123
}

参数说明

参数 说明
permanent_code 永久授权码,用于获取 corp_access_token 和机构授权信息
corpid 机构id
agentid 授权方应用id

获取机构凭证(corp_access_token)

请求方式:POST(HTTPS)

请求地址https://test-oapi.epaas.qq.com/service/get_corp_token?suite_access_token=SUITE_ACCESS_TOKEN

请求包体

 {
     "auth_corpid": "auth_corpid_value",
     "permanent_code": "code_value"
 }

参数说明

参数 是否必须 说明
auth_corpid 授权方 CorpId
permanent_code 永久授权码,通过 get_permanent_code 获取

返回结果

{
    "errcode":0 ,
    "errmsg":"ok" ,
    "access_token": "xxxxxx", 
    "expires_in": 7200
}

参数说明

参数 说明
access_token corp_access_token, 最长为512字节,详细介绍请前往接口调用凭证
expires_in corp_access_token 过期时间(s)

获取机构授权信息

请求方式:POST(HTTPS
请求地址:https://test-oapi.epaas.qq.com/service/get_auth_info?suite_access_token=SUITE_ACCESS_TOKEN
请求包体:

 {
     "auth_corpid": "auth_corpid_value",
     "permanent_code": "code_value"
 }

参数说明:

参数 必须 说明
auth_corpid 授权方CorpId
permanent_code 永久授权码,通过 get_permanent_code 获取

返回结果:

{
    "errcode":0 ,
    "errmsg":"ok" ,
    "auth_corp_info": 
    {
        "corpid": "xxxx",
        "corp_name": "name",       
        "province":"广东省",
        "city":"深圳市",
        "area":"南山区",
        "name":"张三",
        "mobile":"180000000",
        "qywx_corpid":"wx1234234",
    }
}

参数说明:

参数 说明
errcode 返回码
errmsg 对返回码的文本描述内容
auth_corp_info 授权方机构信息
corpid 机构id CorpId
corp_name 机构名称
province 机构所属省
city 机构所属市
area 机构所属区
name 创建人姓名
mobile 创建人手机号
qywx_corpid 对应企业微信id

应用跳转授权

使用场景: 从当前应用跳转至目标应用,下发目标应用code。

是否需额外授权: 否

请求方式: [GET, POST](HTTPS

请求地址: https://test-oapi.epaas.qq.com/sso/oauth2/get_app_code?access_token=ACCESS_TOKEN

参数说明:

参数 必须 说明
access_token 调用接口凭证,使用用户态access_token,由/open/access_token获得
appid 要跳转的目标应用id

返回结果:

{
    "errcode": 0,
    "errmsg": "ok",
    "code": "xxxxxxxxxxxxxx"
}

参数说明:

参数 说明
errcode 返回码
errmsg 对返回码的文本描述内容
code 给目标跳转应用下发的code

results matching ""

    No results matching ""

    results matching ""

      No results matching ""