How to manage session for a user logged in from mobile app in PHP?

前端 未结 7 2014
暖寄归人
暖寄归人 2020-12-23 02:13

I\'m a PHP programmer by profession. So, I don\'t have any idea about iOS and Android coding.

The scenario is there is one website developed using a

7条回答
  •  太阳男子
    2020-12-23 02:42

    REST is sessionless for its nature. You need to generate a token when user logged in. You must save this token on your mobile client. For every request, you need to attach a valid token in request header and check it at server side. If token expires, the token stored on a client is not valid. So, you need to login again because of 401 response. If token it's not correct you need to responde 400. I hope that I'm helpful for you.

提交回复
热议问题