Answer the question
In order to leave comments, you need to log in
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
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) ....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question