美文网首页
微信第三方平台接口

微信第三方平台接口

作者: 会飞一下 | 来源:发表于2019-04-10 15:35 被阅读0次

第三方平台开发流程

image.png

整个流程是第三方平台 提供一个授权的页面供公众号|小程序管理员进行授权, 授权后第三方平台将获得 授权方(公众号|小程序)的以下信息

authorization_info //授权信息
authorizer_appid  //授权方appid
authorizer_access_token   //access_token
expires_in
authorizer_refresh_token
func_info  // 授权的权限列表

然后用获取的 authorizer_appid 及authorizer_access_token 代授权方调用相应的接口

按开放平台的文档上说, 公众号授权第三方平台管理后,微信服务器会将粉丝发给公众号的消息,以及微信服务器发给公众号的事件推送(如自定义菜单点击事件、粉丝取消关注通知等),发给开发者服务器(会发送到公众号消息与事件接收URL,详见申请资料说明页)上 . 也就是说第三方平台会接管消息接口 ,

关键参数

  1. component_verify_ticket
    第三方平台创建审核通过后, 微信服务器每10分钟推送给第三方平台
<xml>
<AppId> </AppId>
<CreateTime>1413192605 </CreateTime>
<InfoType> </InfoType>
<ComponentVerifyTicket> </ComponentVerifyTicket>
</xml>
  1. component_access_token
    第三方平台的所有接口都需要此token调用, 生成方式:
url:https://api.weixin.qq.com/cgi-bin/component/api_component_token
post:
{
    "component_appid": "appid_value",
    "component_appsecret": "appsecret_value",
    "component_verify_ticket": "ticket_value"
}
return:
{
    "component_access_token": "61W3mEpU66027wgNZ_MhGHNQDHnFATkDa9-2llqrMBjUwxRSNPbVsMmyD-yq8wZETSoE5NQgecigDrSHkPtIYA",
    "expires_in": 7200
}
  1. pre_auth_code
    预授权码, 授权时的参数, 生成方式:
url:
https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx
post:
{
    "component_appid": "appid_value"
}

return:
{
    "pre_auth_code": "Cx_Dk6qiBE0Dmx4EmlT3oRfArPvwSQ-oa3NL_fwHM7VI08r52wazoZX2Rhpz1dEw",
    "expires_in": 600
}
  1. auth_code
    授权回调参数, 生成方式
url:
 https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx&auth_type=xxx&biz_appid=xxxx#wechat_redirect

return :
https://redirect_url/?auth_code=xxx&expires_in=600
  1. authorizer_appid , authorizer_access_token..
    用户授权后 通过回调的 auth_code ,expires_in 获取授权方的appid , access_token 用于代授权方公众号|小程序调用接口
url:
https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=xxxx
post:
{
    "component_appid": "appid_value",
    "authorization_code": "auth_code"
}

return :
{
    "authorization_info": {
        "authorizer_appid": "wxf8b4f85f3a794e77",
        "authorizer_access_token": "QXjUqNqfYVH0yBE1iI_7vuN_9gQbpjfK7hYwJ3P7xOa88a89-Aga5x1NMYJyB8G2yKt1KCl0nPC3W9GJzw0Zzq_dBxc8pxIGUNi_bFes0qM",
        "expires_in": 7200,
        "authorizer_refresh_token": "dTo-YCXPL4llX-u1W1pPpnp8Hgm4wpJtlR6iV0doKdY",
        "func_info": [
            {
                "funcscope_category": {
                    "id": 1
                }
            },
            {
                "funcscope_category": {
                    "id": 2
                }
            },
            {
                "funcscope_category": {
                    "id": 3
                }
            }
        ]
    }
}
  1. 刷新 authorizer_access_token
url:
https:// api.weixin.qq.com /cgi-bin/component/api_authorizer_token?component_access_token=xxxxx

post:
{
    "component_appid": "appid_value",
    "authorizer_appid": "auth_appid_value",
    "authorizer_refresh_token": "refresh_token_value"
}
reutrn :
{
    "authorizer_access_token": "aaUl5s6kAByLwgV0BhXNuIFFUqfrR8vTATsoSHukcIGqJgrc4KmMJ-JlKoC_-NKCLBvuU1cWPv4vDcLN8Z0pn5I45mpATruU0b51hzeT1f8",
    "expires_in": 7200,
    "authorizer_refresh_token": "BstnRqgTJBXb9N2aJq6L5hzfJwP406tpfahQeLNxX0w"
}
  1. 获取授权帐号信息
url:
https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token=xxxx
post:
{
    "component_appid": "appid_value",
    "authorizer_appid": "auth_appid_value"
}
return:
{
    "authorizer_info": {
        "nick_name": "微信SDK Demo Special",
        "head_img": "http://wx.qlogo.cn/mmopen/GPy",
        "service_type_info": {
            "id": 2
        },
        "verify_type_info": {
            "id": 0
        },
        "user_name": "gh_eb5e3a772040",
        "principal_name": "腾讯计算机系统有限公司",
        "business_info": {
            "open_store": 0,
            "open_scan": 0,
            "open_pay": 0,
            "open_card": 0,
            "open_shake": 0
        },
        "alias": "paytest01",
        "qrcode_url": "URL"
    },
    "authorization_info": {
        "authorization_appid": "wxf8b4f85f3a794e77",
        "func_info": [
            {
                "funcscope_category": {
                    "id": 1
                }
            },
            {
                "funcscope_category": {
                    "id": 2
                }
            },
            {
                "funcscope_category": {
                    "id": 3
                }
            }
        ]
    }
}

  1. 获取授权方的选项设置信息
url:
https://api.weixin.qq.com/cgi-bin/component/ api_get_authorizer_option?component_access_token=xxxx
post:
{
    "component_appid": "appid_value",
    "authorizer_appid": " auth_appid_value ",
    "option_name": "option_name_value"
}

return:
{
    "authorizer_appid": "wx7bc5ba58cabd00f4",
    "option_name": "voice_recognize",
    "option_value": "1"
}

option 值:

option_name option_value 选项值说明
location_report(地理位置上报选项) 0 无上报
location_report(地理位置上报选项) 1 进入会话时上报
location_report(地理位置上报选项) 2 每5s上报
voice_recognize(语音识别开关选项) 0 关闭语音识别
voice_recognize(语音识别开关选项) 1 开启语音识别
customer_service(多客服开关选项) 0 关闭多客服
customer_service(多客服开关选项) 1 开启多客服
  1. 设置授权方的选项信息
url:
https://api.weixin.qq.com/cgi-bin/component/ api_set_authorizer_option?component_access_token=xxxx
post:
{
"component_appid":"appid_value",
"authorizer_appid": " auth_appid_value ",
"option_name": "option_name_value",
"option_value":"option_value_value"
}
return:
{
"errcode":0,
"errmsg":"ok"
}
  1. 授权通知
    公众号|小程序在授权页进行操作时, 微信服务器将事件推送给第三方平台设定的url
  • . 授权成功
<xml>
<AppId>第三方平台appid</AppId>
<CreateTime>1413192760</CreateTime>
<InfoType>authorized</InfoType>
<AuthorizerAppid>公众号appid</AuthorizerAppid>
<AuthorizationCode>授权码(code)</AuthorizationCode>
<AuthorizationCodeExpiredTime>过期时间</AuthorizationCodeExpiredTime>
<PreAuthCode>预授权码</PreAuthCode>

<xml>
  • . 取消授权
<xml>
<AppId>第三方平台appid</AppId>
<CreateTime>1413192760</CreateTime>
<InfoType>unauthorized</InfoType>
<AuthorizerAppid>公众号appid</AuthorizerAppid>

</xml>
  • . 更新授权
<xml>
<AppId>第三方平台appid</AppId>
<CreateTime>1413192760</CreateTime>
<InfoType>updateauthorized</InfoType>
<AuthorizerAppid>公众号appid</AuthorizerAppid>
<AuthorizationCode>授权码(code)</AuthorizationCode>
<AuthorizationCodeExpiredTime>过期时间</AuthorizationCodeExpiredTime>
<PreAuthCode>预授权码</PreAuthCode>
<xml>
-- --
字段名称 字段描述
AppId 第三方平台appid
CreateTime 时间戳
InfoType unauthorized是取消授权,updateauthorized是更新授权,authorized是授权成功通知
AuthorizerAppid 公众号或小程序
AuthorizationCode 授权码,可用于换取公众号的接口调用凭据,详细见上面的说明
AuthorizationCodeExpiredTime 授权码过期时间
PreAuthCode 预授权码
  1. 拉取当前所有已授权的帐号基本信息
url:
https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_list?component_access_token=COMPONENT_ACCESS_TOKEN
post:
{
    "component_appid": "appid_value",
    "offset": 0,
    "count": 100
}

return:
{
    "total_count": 33,
    "list": [
        {
            "authorizer_appid": "authorizer_appid_1",
            "refresh_token": "refresh_token_1",
            "auth_time": "auth_time_1"
        },
        {
            "authorizer_appid": "authorizer_appid_2",
            "refresh_token": "refresh_token_2",
            "auth_time": "auth_time_2"
        }
    ]
}

相关文章

  • 1.5研习 | 微信第三方平台

    简单一点说,微信是一个开放的平台。 微信的官方,会开放一些接口,所以微信第三方平台就诞生了。 第三方平台很多,功能...

  • 干货丨微信开放、公众、商户平台简介

    01 微信开放平台 (1)概念 微信开放平台是一个为第三方移动程序提供接口的平台。 (2)作用 用户可将第三方程序...

  • 微信第三方平台

    1.微信第三方平台是什么? 微信是一个开放的平台,所以能够通过自定义接口接入第三方后台管理系统,接入的平台就叫第三...

  • 微信第三方平台开发

    小记在开发微信第三方平台遇到的困难 小程序模板添加 微信写得接口文档太不详细, 没写清楚逻辑, 以至于有接口 但不...

  • 微信大屏幕是怎么做的

    微信大屏幕又称为微信上墙、微信墙等,是第三方平台基于微信公开接口而研发的产品,在时下很多活动场所应用广泛。 微信大...

  • PHP后台支付的开发:微信支付和支付宝支付

    微信支付 项目前提:本人用的是tp框架,PHP语言 下载到微信平台提供的微信支付接口文件,放在了tp第三方类库ve...

  • 接口在线调试

    微信公众号开发需要熟悉各个接口的调用,我们推出了微信公众平台接口在线调试工具。 进入微信公众平台接口调试工具

  • 10/11 课堂笔记

    常用社交软件微信 微博 QQSDK微博开放平台微信开放平台微信第三方平台管理QQ开放平台用户体验好 界面美观 功能...

  • 一站式整体互联网品牌运营解决方案提供商

    微信代运营哪家好? 微信代运营哪家好?首选广州善德信息科技有限公司。现在有很多微信第三方平台,在选择微信第三方平台...

  • 微信公众平台

    开发文档 微信公众平台测试号申请 微信公众平台接口调试工具

网友评论

      本文标题:微信第三方平台接口

      本文链接:https://www.haomeiwen.com/subject/cfkniqtx.html