I
I
Igor Bezlepkin2016-07-01 10:45:20
Android
Igor Bezlepkin, 2016-07-01 10:45:20

What is the correct way to check the access_token on the Android server?

Hey! At the first launch and subsequent android application, you need to check the availability and relevance of the access_token.
Do I understand correctly: If it is not in the phone database, we do authorization on the server and get a token, enter it into the database.
If there is a token, we send a test request to check the token, like api.site.ru/v1/auth/check;
if it is clumsy, we proceed to the registration stage.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2016-07-01
@IceJOKER

Instead of it is better to check during request something?
Those. store the token locally and send it where the token is needed, and the server already checks - the token is up-to-date - gives a normal answer, not up-to-date - gives an error and a specific code that the token is not up-to-date.
If you receive an error that the token is not relevant, you need to refresh it.
In this way you get rid of unnecessary requests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question