php - What is the significance of token in APP development? How to judge the user's status
PHP中文网
PHP中文网 2017-06-28 09:22:44
0
2
998

I have been writing interfaces recently and I have read many answers about what is the meaning of token? How to judge the user's status on the APP? Currently, the token is used as a cookie on the web, and then the token is used to determine the status of the unused user, or which user is being requested now

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
曾经蜡笔没有小新

Since the App is stateless and unlike a browser that can store the user's session information, the server will send a token to the client after verifying its login. This token will be brought to the service when requesting the API in the future. The client can obtain the user information requesting the interface, which is mainly the identification of user information.

Another situation is to request the permission of a certain interface on the server side, such as activating the token when binding the mailbox.
The above are the actual scenarios I encountered during development. There may be other functions, but I don’t have much to delve into.

The status determination can be stored in redis, and the token is used as the key of redis, or the token itself is an encrypted string that can be decoded.

The above is also the situation I encountered in actual development. Let’s discuss other situations together.

扔个三星炸死你

Token is to allow the server to identify the user just like a browser cookie. Generally, a token is generated and returned to the client after logging in. Each subsequent request will bring the token parameter, and the token will be refreshed next time you log in

For PHP, it is recommended to use the mature jwt.io

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!