Home  >  Q&A  >  body text

php - What is the significance of token in APP development? How to judge the user’s status

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中文网2690 days ago1001

reply all(2)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-28 09:24:44

    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.

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-28 09:24:44

    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

    reply
    0
  • Cancelreply