A
A
Alexander Shibaev2016-04-08 14:29:56
PHP
Alexander Shibaev, 2016-04-08 14:29:56

How to organize your authorization with a token on Android?

Hello!
I am still learning programming, and now I am writing an Android client for a web resource. I understand how to organize the simplest authorization between the Android application and the server in php. But I didn’t quite figure out how to make it so that I sent username and password to the server, and already received a token from the server and wrote it down in shared preferences, for further authorization already by token. I understand how to give a token from the server, I’m interested in exactly how to accept a token on Android and write it to the storage for subsequent authorization using it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Gamega, 2016-04-08
@Dpa7DuJIJIep

just in the server response when logging in, give in the json token what else is needed for the client to work, for example, the user id and the avatar
, then sign each request with this token - you can use it in the header, you can as a parameter (not worth it, but you can) ....

I
IceJOKER, 2016-04-08
@IceJOKER

How to give a token from the server you know what SharedPreferences is too, so what's the problem?
The server has given, the program accepts and saves the token.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question