# 微信开放平台
## 三方平台接口对接
### 授权流程
```mermaid
graph TB
start(开始) --> pre_auth(获取预授权码)
```
授权网页链接:
https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx&auth_type=xxx。
### 创建小程序
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Fast_Registration_Interface_document.html
### 授权类型
要授权的帐号类型,
1 则商户扫码后,手机端仅展示公众号、
2 表示仅展示小程序,
3 表示公众号和小程序都展示。
如果为未指定,则默认小程序和公众号都展示。
### 参考文档
[第三方开放平台接口开发文档](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Authorization_Process_Technical_Description.html)
### 3、公众号,小程序授权调整
#### 1) 使用appid,secret,ticket 交换第三方token
```接口:/cgi-bin/component/api_component_token
json参数:{
"component_appid": "appid_value" ,
"component_appsecret": "appsecret_value",
"component_verify_ticket": "ticket_value"
}
```
#### 2) 生成预授权码
```
接口:/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN
参数:{
"component_appid": "appid_value"
}
```
#### 3)根据生成预授权码生成url
```
接口:/componentloginpage?component_appid={0}&pre_auth_code={1}&auth_type={3}&redirect_uri={2}
component_appid 是 第三方平台方 appid
pre_auth_code 是 预授权码
redirect_uri 是 回调 URI
auth_type 否 要授权的帐号类型,
1 则商户扫码后,手机端仅展示公众号、
2 表示仅展示小程序,
3 表示公众号和小程序都展示。如果为未指定,则默认小程序和公众号都展示。第三方平台开发者可以使用本字段来控制授权的帐号类型。
biz_appid 否 指定授权唯一的小程序或公众号
```
#### 4、保存授权信息(可以暂时使用业务系统中的)
```
```
#### 5、获取公众号或小程序access_token
```
接口:/cgi-bin/component/api_authorizer_token?component_access_token=COMPONENT_ACCESS_TOKEN
参数:{
"component_appid": "appid_value",
"authorizer_appid": "auth_appid_value",
"authorizer_refresh_token": "refresh_token_value"
}
```
#### 5、小程序发布中模板信息
```
获取小程序版本
接口:/wxa/gettemplatelist?access_token=
```
#### 6、授权事件接收
## H5
## PC端
### 1、第三方平台配置
### 2、微信推送的ticket收录
1)从url 中获取nonce(随机数),timestamp(时间缀),msg_signature(微信那边的签名)
2)读取post的数据,解析xml,获取xml中的加密信息、
3)生成签名,根据token(检验token)、timestamp(时间缀),nonce(随机数),encryptmsg(加密密文)
4)校验签名是否正确
5) 减密密文,获取appid,根据aeskey
6)校验appid与第三方的是否一致
7)返回减密后的内容,并保存ticket
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
wechat-rs-master.zip (92个子文件)
wechat-rs-master
wechat.code-workspace 70B
mp
Cargo.toml 468B
src
message
event.rs 1KB
mod.rs 1KB
parser.rs 3KB
text.rs 2KB
kf.rs 2KB
unknown.rs 1KB
reply
mod.rs 907B
articles.rs 5KB
text.rs 1KB
voice.rs 2KB
image.rs 2KB
enums.rs 596B
authorize.rs 4KB
lib.rs 290B
README.md 196B
Cargo.toml 1KB
store
Cargo.toml 220B
src
lib.rs 95B
README.md 130B
src
lib.rs 2KB
open
Cargo.toml 538B
src
open.rs 4KB
lib.rs 967B
config.rs 4KB
weapp
code.rs 6KB
mod.rs 250B
category.rs 2KB
tester.rs 2KB
domain.rs 2KB
auth.rs 3KB
ticket.rs 1KB
comp.rs 10KB
flow.drawio 10KB
README.md 3KB
LICENSE 1KB
sdk
Cargo.toml 1KB
src
wxcrypto.rs 12KB
errors.rs 5KB
lib.rs 3KB
url_encoding.rs 369B
constant.rs 392B
token.rs 4KB
config.rs 4KB
macros.rs 2KB
aes_crypt.rs 5KB
xmlutil.rs 1KB
actix_client.rs 11KB
reqw_client.rs 4KB
web
examples
test_comp.rs 12KB
actix
Cargo.toml 913B
src
utils.rs 3KB
main.rs 3KB
wx_handler.rs 13KB
official.rs 4KB
result_response.rs 1KB
config.rs 0B
access_token.rs 1KB
cache.rs 3KB
cluster.rs 5KB
wx_msg.rs 9KB
install.sh 163B
axum
Cargo.toml 343B
src
main.rs 45B
README.md 345B
build.sh 111B
git.sh 891B
pay
Cargo.toml 460B
src
lib.rs 1KB
order.rs 6KB
README.md 15B
weapp
Cargo.toml 1KB
src
ocr.rs 160B
lib.rs 513B
message.rs 1KB
subscribe.rs 354B
config.rs 2KB
qrcode.rs 6KB
plugin.rs 328B
auth.rs 4KB
near.rs 261B
README.md 1KB
redis
Cargo.toml 368B
src
lib.rs 476B
config.rs 2KB
session.rs 16KB
work
Cargo.toml 219B
src
lib.rs 95B
README.md 22B
.gitignore 462B
flow.drawio 0B
共 92 条
- 1
资源评论
m0_72731342
- 粉丝: 2
- 资源: 1832
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功