Home  >  Article  >  Backend Development  >  APP调用的接口如何实现用户登陆控制和判断的

APP调用的接口如何实现用户登陆控制和判断的

WBOY
WBOYOriginal
2016-06-06 20:35:021265browse

pc端的应用 可以用cookie或者session来判断用户的登陆状态,一直不清楚app端是如何实现的

回复内容:

pc端的应用 可以用cookie或者session来判断用户的登陆状态,一直不清楚app端是如何实现的

app一般和app服务器是通过一套api进行数据交互的,客户端登录成功后,会生成一组密钥,保存在客户端本地缓存或者数据库,客户端每次请求数据,都会向服务器提交密钥,一般在请求的header中,也可是和数据一起提交。这个密钥最好是唯一的,甚至还要进行一定的加密手段。密钥可以设置有效时间,过了有效时间后就要重新登录重新生成。这是我做app的思路。其实和web中cookie的差不多吧。

可参考Oauth2.0

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
Previous article:CI 问题 curlNext article:如何高效的做数据覆盖操作