当前位置:网站首页>Wechat applet magic bug - choose to replace the token instead of clearing the token, wx Getstoragesync will take the old token value instead of the new token value
Wechat applet magic bug - choose to replace the token instead of clearing the token, wx Getstoragesync will take the old token value instead of the new token value
2022-06-26 13:26:00 【woowen!】
Problem flow description :
In general , Whenever a user chooses to log out , The code will store the already saved token Values or other data are cleared . When you log in again, you can store the new token value .
But if the code does not include the original token kill , Instead, choose to replace the old value with the new value , There will be a magical bug:
use wx.getStorageSync take token when , Will take the old one token value , Have you ever encountered such a problem ?
Of course, I don't think this is very reasonable , After all, after logging out , You should clean up the old data , The above is just a question for me , Here is the question record
what
Why is that ?
Every time a user logs in, they change token value

But if you log in , Not cleared token, Instead, replace it with a new one token, When you jump to a web page outside the applet , Value token It will be the last time token!!! What's going on here
// Approval progress
import api from '../../apis/api'
import config from './../../config/config'
Page({
data: {
env: config.env == 'test' ? 'https://test-trading.linkingjz.com/#/mobileBpmn' : 'https://trade.linkingjz.com/#/mobileBpmn',
url: '',
paramsToken: '',
paramsUserId: ''
},
onLoad(option) {
let _this = this
new Promise((resolve) => {
_this.setData({
paramsToken: wx.getStorageSync(config.USER_TOKEN),
paramsUserId: wx.getStorageSync(config.USER_ID)
})
resolve()
}).then(res => {
this.handlerInit(option)
})
},
/** ------------------------------------------- Method --------------------------------------------- */
// Initialize page data
handlerInit(option) {
console.log(option)
this.setData({
url: `${this.data.env}/${option.pid}/${option.businessId}/${option.type}?token=${this.data.paramsToken}&userId=${this.data.paramsUserId}&nickname=''`
}, function () {
console.log(this.data.url)
})
},
})If you have any ideas, please leave a message
边栏推荐
- MariaDB study notes
- Arcpy——InsertLayer()函數的使用:摻入圖層到地圖文檔裏
- Electron official docs series: Testing And Debugging
- 7-2 the cubic root of a number
- Processsing function random
- Vivado error code [drc pdcn-2721] resolution
- Generate JDE dot train
- [how to connect the network] Chapter 1: the browser generates messages
- Zoomeeper sets ACL permission control (only specific IP access is allowed to enhance security)
- Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
猜你喜欢

Es sauvegarde et restauration des données par instantané

ES6:Map

Arcpy - - utilisation de la fonction insertlayer (): ajout de calques dans un document de carte

Beifu PLC realizes data power-off maintenance based on cx5130

装饰器(Decorator)

Chapter 10 setting up structured logging (2)

Beifu realizes the control of time slice size and quantity through CTU and ton

Firewall introduction

Arcpy——InsertLayer()函數的使用:摻入圖層到地圖文檔裏

Electron official docs series: Get Started
随机推荐
[how to connect the network] Chapter 1: the browser generates messages
Word document export (using fixed template)
Analysis of state transition diagram of Beifu NC axis
Lamp compilation and installation
Processing polyhedron change
7-16 monetary system I
[shell] generate strings between specified dates
MySQL讲解(二)
First pass! Baidu AI Cloud Xiling platform has obtained the authoritative certification of digital human ability evaluation from the Institute of information technology
A primary multithreaded server model
HDU 3555 Bomb
LeetCode_ Stack_ Medium_ 150. evaluation of inverse Polish expression
B - Bridging signals
Electron official docs series: Get Started
To solve the difficulties of small and medium-sized enterprises, Baidu AI Cloud makes an example
KITTI Detection dataset whose format is letf_ top_ right_ bottom to JDE normalied xc_ yc_ w_ h
Awk tools
ES基於Snapshot(快照)的數據備份和還原
泰山OFFICE技术讲座:使用字体粗体的四种情形
Arcpy - - utilisation de la fonction insertlayer (): ajout de calques dans un document de carte