微信小程序綁定到第三方平臺流程

微信小程序授權綁定到第三方開放平臺的過程,官方文檔 寫的不太清晰,在這裏梳理羅列一下。

1 服務器準備,開通開放平臺

域名填寫:weixin.mydomain.cn 
IP白名單:47.888.888.888
授權事件接收URL:http://weixin.mydomain.cn/api/weixin/platform/grant-msg

消息校驗token:htqa****************
消息加密Key:NCVs00ht8gr***************************************
消息與事件接收:http://weixin.mydomain.cn/api/weixin/business/msg/$APPID$/callback

 

2 綁定開發小程序

(1)第三方平臺的開發人員需先到微信公衆平臺(mp.weixin.qq.com)申請一個普通的小程序並完善小程序的頭像、暱稱、簡介、服務類目等信息。

(2)進入微信開放平臺,在第三方平臺詳情中,將該小程序添加爲開發小程序

注意: 綁定爲開發小程序後,該小程序的在開發工具中上傳,代碼會直接上傳到開放平臺,不會上傳到公衆平臺。

 

3 爲租戶上傳小程序

獲取微信後臺推送的 ticket  -> 用來獲取 “第三方平臺component_access_token”
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_verify_ticket.html

 

獲取第三方平臺 component_access_token -> 用來獲取 “第三方平臺接口調用令牌”
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_access_token.html

 

獲取第三方平臺接口調用令牌 authorizer_access_token -> 用來上傳小程序
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/api_authorizer_token.html

客戶授權流程  https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Authorization_Process_Technical_Description.html

  1)獲取預授權碼 pre_auth_code  https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/pre_auth_code.html
  2)生成授權網頁鏈接
  3)用戶訪問授權頁面授權 後 返回回調頁面
  4)回調頁面得到授權碼, 授權流程完成後,授權頁會自動跳轉進入回調 URI,並在 URL 參數中返回授權碼和過期時間(redirect_url?auth_code=xxx&expires_in=600)
  5) 調用上傳小程序接口

 

上傳小程序代碼
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/code/commit.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章