java - 关于从微信企业号登陆到自己做的系统的问题
迷茫
迷茫 2017-04-18 10:02:10
0
2
409
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all (2)
洪涛

It is not recommended to return the account password. You can use this account password to generate a temporary string in your own way. We first call it a token, and then associate this token with the user's account password, and set the destruction time for the token. The server returns the token to the user, writes it into cookies, and then extracts the token with each request as user information.

    阿神

    From the WeChat user accessing a specific URL to the server, this step is already a login operation, so I don’t quite understand why the account and password are returned in Figure 2.

    As @水爱 said, after the user successfully logs in, a token with expiration time is generated on the server and returned to the user. At the same time, a token is saved in the server cache (such as memcached, redis), and the user checks it every time he visits the server. Does the token still exist in the cache? If so, it is legal. Otherwise, log in again.

    The above verification is relatively simple. Depending on the security requirements of your business for login verification, you can design a more secure but more complex solution.

    Safety is directly proportional to cost and inversely proportional to convenience, and needs to be measured in business.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!