I making an app in android that needs to login to a website I made, but I'm debating what is the best and secure way to do this. I also have my own idea, but not sure how to implement it. I'm only asking about how to implement the "Hey I'm logged in'' idea. Not the verifying/storing/escaping strings part. Only about how to create a secure session between the user and the server.
From what I saw in google, most/all approaches are using the global php $_SESSION variable, but apparently there are many security issues with this, so I'm thinking not to use it at all.
What does big websites do? like gmail? how do they do it? and how do they implement the 'remember me' option? I here that they give you some token for each login, it that correct?
Finally - I have my own idea and want to know what you think of it: when a user logges in, he gets back a code made of his credentials, and some random value - all will be hashed (sha256) . He will save it in his shared preferences. This code will also be stored on the server's 'logged in' database. Now, every time he queries the server, he will have to send the code that he got.
So what do you think?