Home  >  Article  >  Backend Development  >  How to set the token expiration time in php yii2

How to set the token expiration time in php yii2

WBOY
WBOYOriginal
2016-08-10 09:07:202015browse

My current token uses a forward and reverse encryption. The first time is to encrypt the user's ID and pass it to ios. Then every time he passes the encrypted value to me, I decrypt it again and use the decrypted ID. Then go to the database to query whether this user exists. Now I need to set the expiration time of a token. I would like to know how to set it. I wrote the interface under the framework of yii2. Or if the experts have some better ways to set the token, you can also enlighten me. Thank you very much

Reply content:

My current token uses a forward and reverse encryption. The first time is to encrypt the user's ID and pass it to ios. Then every time he passes the encrypted value to me, I decrypt it again and use the decrypted ID. Then go to the database to query whether this user exists. Now I need to set the expiration time of a token. I would like to know how to set it. I wrote the interface under the framework of yii2. Or if the experts have some better ways to set the token, you can also enlighten me. Thank you very much

Wouldn’t it be great if you asked iOS to encrypt the expiration time as well?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn