java - 客户端软件如何保存用户的登录信息 来和服务端交互呢
黄舟
黄舟 2017-04-18 10:32:20
0
2
820

最近想用 nodejs 的electron 做一个客户端软件 是需要验证身份的 服务端用php api接口形式输出数据。

有个疑惑,如果是在web浏览器中,用户登录可以存放在 cookie 或者cookie中的session中 但是在客户端情况下 客户的身份验证应该存在哪里呢 也是在cookie里面吗 一般传统的 c/s架构软件是怎么存放的呢?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
巴扎黑

electron actually runs a web page, and the communication methods are generally only http and websocket, which can be processed in the usual way of spa (single page application).

Recommend jwt to do it

洪涛

For example, Android will store the username, password, and cookie locally.
When accessing the server, the cookie will be brought there, and the server will verify the cookie through the session.
The session has expired. Tell the client that the session has expired through HTTP status code or custom status code.
The APP reads the username and password from the local and sends HTTP to complete the login. If the login is successful, the server returns the new cookie to the client. ,
The client updates the locally stored cookie value after receiving it.
To verify identity, you don’t have to use session or cookie, you can also use Token.
Recommend a token called jwt, https://jwt.io/.
I used it in an APP I made recently and thought it was good

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!