javascript - Frontend login issue
世界只因有你
世界只因有你 2017-05-19 10:38:00
0
5
628

The company's development model is front-end cutting and PHP pages. I have been cutting pictures for several months. After work, I have been recharging myself intermittently (after all, I became a monk halfway). I also came into contact with the separation of front-end and back-end. , vue.js and other things. At this time, I thought of a problem. After the current backend is separated and the user logs in, the backend must give the frontend a specific key value (let’s call it that for the time being, because I don’t have a specific concept) To determine a specific user, so as to provide different interfaces for different users. So where should the front-end store the key value reasonably?

If you are in a good mood, you can answer it in detail. If you are too lazy to explain, you can give me a few keywords and I will try to search them myself. Thank you

世界只因有你
世界只因有你

reply all(5)
给我你的怀抱

Each user will have his or her own token, and save the token in cookie. Some basic information of the user will be stored in sessionStorage or localStorage. If the verification is passed, token verification will be fine

我想大声告诉你

cookie

漂亮男人
  1. After the backend verifies the frontend login successfully, an encrypted token is returned

  2. The front-end stores the token in cookie or localstorage, and brings the token with each request. If the back-end verification passes, the data will be returned. If the verification fails, the corresponding status will be returned

洪涛

jwt verification mechanism

淡淡烟草味

json+web+token verification method

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