Y
Y
yanis_kondakov2018-08-28 06:11:51
Software design
yanis_kondakov, 2018-08-28 06:11:51

How to save authorization in the application?

Good day to all!
I do not know what tags to put, do not judge strictly.
1) The client is logged in
2) Works with the application
3) There is Internet on the phone, but the application server has stopped working
4) The client closes the application. Then opens. Authorization flies.
If you do not reset the token, if it already exists, and the server is not available, then if the client moves to another domain, then he will not be able to log in again.
How to correctly save authorization?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-08-28
@yanis_kondakov

And where does the token in the application? You need to save the user session between servers, that's all.
How to store the token on the client's device depends on the platform. For android - internal storage and the MOD_PRIVATE flag on the token file, for example.
UPD. The question is not entirely correct. The user session must be persisted between servers. As an option - an authorization server, so as not to suffer with certificates. More specifically on the stack of technologies, you can inf? Maybe even suggest a specific solution.
UPD.2 Duplicated from a comment, as comments are hidden by default.
So, in short, without abstruse words, a quick recipe:
1) in php we write our own session handler that saves sessions in a database (!) located on a separate server that has good uptime (well, or in your mind, a failover cluster)
2) when authorizing on the server, our fashionable session handler implementation is used, 16 bit key If the login is successful, the session is saved in the database, the same key is given to the client application via HTTPS and stored on
it . The session is loaded from the database.
Everything. This is a draft "and so it will do" version. The session key itself is stored on the device in private application files.
Wisely use ready-made solutions a lahttps://openid.net/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question