swift - ios development how to maintain session with php backend server

WBOY
Release: 2016-09-14 09:41:24
Original
1100 people have browsed it

Should I still use session? Or what? Please answer

Reply content:

Should I still use session? Or what? Please answer

Just add something like access-token in the header.

Similar to the principle of including sessionId in the request

There is rarely a need for the client to maintain a session with the backend.

Usually the token mechanism is used. After the user logs in, the backend will generate a token and return it to the client. After that, all api requests from the client must bring the user ID and token. The backend api must verify the id before executing the request. and whether the token is correct, and at the same time we know which user the request comes from. It can be simply understood that token is a temporary password.

As for the security mechanism of tokens, it is too extensive, and there are many mature solutions. Search by yourself

Simple, session_id+signature verification

Pass a login status token in the interface parameter

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template