当前位置:网站首页>Wechat applet must use interface "suggestions collection"
Wechat applet must use interface "suggestions collection"
2022-07-27 12:03:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Wechat applet must use interface
- obtain openid
- uni-app Example
obtain openid
openid It is a unique identification of wechat users , Only valid for current micro signals . Wechat development , Users need authorization to use the applet , This is the time to use openid Bind this user . Can be used to permanently mark a user , It is also wechat JSAPI Mandatory parameters for payment .
In general, they will code The value goes to the back end to get openid, Because in the front end it may be caught or crawled to your appid and secret, unsafe , If you put it on the back end to get openid, Unless your server is attacked , Or it's safe . The following example is obtained directly at the front end , When this is understood , It can be changed directly to the back end , It's the same logic .
uni-app Example
uni.login({
success: res => {
//code value (5 Minutes out )
console.info(res.code);
// Applet appid
let appid = ''; // Fill in appid
// Applet secret
let secret = ''; // Fill in secret
//wx Interface path
let url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret + '&js_code=' + res.code + '&grant_type=authorization_code';
uni.request({
url: url, // Request path
method: 'GET', // Request mode
success: result => {
// Response successful
// Here we get openid 了
console.info(result.data.openid);
uni.setStorage({
key:'user',
data: result.data.openid
})
},
fail: err => {
} // Failure
});
}
});// TODO To be continued
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/128206.html Link to the original text :https://javaforall.cn
边栏推荐
- 数据库 cli 工具 docker 镜像
- 系统临时文件的写和读:createTempFile和tempFileContent[通俗易懂]
- Packet transmission: application layer - kernel - hardware
- Japan Fukushima waste dump safety monitoring agreement will recognize the "safety" of the sea discharge plan
- Firewall firewall
- Proteus8专业版破解后用数码管闪退的解决
- TapNet: Multivariate Time Series Classification with Attentional Prototypical Network
- deeplab系列详解(简单实用年度总结)
- Beyond compare 3 next difference segment / down search arrow not found
- 53 亿 BI 市场 TOP 10:帆软、微软、永洪、SAP、百度、IBM、SAS、思迈特、Salesforce、浪潮通软
猜你喜欢

MATLAB画带延时系统的伯德图
Synchronous use reference of the new version of data warehouse (for beginners)

Keil MDK compilation appears..\user\stm32f10x H (428): error: # 67: expected a "}" wrong solution

Shell脚本文本三剑客之sed

In the first half of the year, the number of fires decreased by 27.7%. Guangdong will improve the fire safety quality of the whole people in this way
![[unity entry program] creator kitfps: first person shooting 3D game](/img/2b/78b535973b2898f53752ceeb25ef01.png)
[unity entry program] creator kitfps: first person shooting 3D game

Could not load dynamic library ‘libcudnn.so.8‘;

EfficientNet

Analysis of the use of JUC framework from runnable to callable to futuretask

Tlc549proteus simulation &sallen key filter &ad736vrms to DC conversion &proteus view 51 register value
随机推荐
Sword finger offer notes: T53 - I. find numbers in the sorted array
Strictly control outdoor operation time! Foshan housing and Urban Rural Development Bureau issued a document: strengthening construction safety management during high temperature
Shell script text three swordsman awk
LNMP架构搭建(部署Discuz论坛)
[unity entry program] creator kitfps: first person shooting 3D game
go入门篇 (3)
剑指 Offer 笔记: T58 - I. 翻转单词顺序
Sword finger offer notes: t58 - I. flip word order
deeplab系列详解(简单实用年度总结)
[网摘][医学影像] 常用的DICOM缩略图解释以及Viewer converter 转换工具
Japan Fukushima waste dump safety monitoring agreement will recognize the "safety" of the sea discharge plan
Tlc549proteus simulation &sallen key filter &ad736vrms to DC conversion &proteus view 51 register value
A possibility that ch340 module cannot be recognized / burned
Makefile template
go入门篇 (4)
CLS 监控告警:实时保障线上服务高可用性
解决@OneToMany查询陷入循环引用问题
Interaction free shell programming
JS-寄生组合式继承
Introduction to box diagram