How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django?

前端 未结 6 1928
粉色の甜心
粉色の甜心 2021-02-01 07:58

I\'m in early (pre-coding) stages of developing a mobile web application using jQuery Mobile (we looked at Sencha Touch for a few weeks, but jQuery Mobile is a better fit for ou

6条回答
  •  不要未来只要你来
    2021-02-01 09:03

    This was one of the burning questions I had when I started mobile development with PhoneGap. Let me explain what I do to get through.

    When the users try to login to he/she enters the username and password which will be sent via a web service call to the server side. If the authentication is successful issue a token to the user and save it at the server side for the future communication. User will receive the token and it will be saved in the local storage or whatever mechanism you prefer.

    Now for future communication use the token, token will be passed with the every web service call to the server side where server will authenticate whether the token is a valid token issued by the server. You can invalidate the token by every 72 hours or 48 hours as pre your requirement(or not expiring). Once the token is invalidated you will have to login and get a new token.

    Hope this solve your problem.

提交回复
热议问题