angular.js - How does angular maintain openid status during official account development?
ringa_lee
ringa_lee 2017-07-04 13:44:38
0
2
1303

I encountered a problem with persistent openid when using the WeChat public account. In the current project, the server side is used to obtain the openid and then store it in the session and then return to the front end. There is a public base.js file in angular to asynchronously obtain the openid and Write to localStorage for other pages to call.

The current problem is that after entering the page for the first time to obtain the openid, it can be used normally in the page, and it can also be obtained when jumping between pages. However, once WeChat is closed from the background and then entered and clicked on the official account menu, the openid will be obtained again. , and then redirected to the page defined in redirect_url, causing the user to be unable to enter the corresponding menu normally. I don’t know whether Angular’s ​​method of obtaining openid is wrong or the server’s approach is wrong. I hope you can give me some advice!

ringa_lee
ringa_lee

ringa_lee

reply all(2)
滿天的星座

The description of this problem is not very clear. If you want to obtain an openid, you must authorize it through WeChat's web page. First get the authorization code, and then get the openid. So openid tries to cache it.

刘奇

It stands to reason that the program runs in the browser provided by WeChat. When WeChat is launched, the program must also be closed. When entering here, go to the server again to get it, everything is new. In fact, the openId can be saved in the service, and there is no need to save it in local storage.

I don’t understand what you mean, please sort it out again.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template