I have recently started toying with an android application, and I have gotten to the point where I want it to communicate with a web service, I understand completely how to do this in an insecure way, where I am slightly tripped up is on security.
I want it to work much like the facebook app on my phone does, it is always logged in, never seems to expire.
my first idea was to use User / Pass and save them locally on the phone with SSL encryption. But this can be a security issue with a lost phone being rooted and then people can see the login and pass (even if they are hashed/encrypted, this seems like an issue)
my other option is to use Oauth 1a/2 but this seems to have the same problem if I am not mistaken, except with a auth token, meaning the same problem occurs except at an api layer.
I have also looked into androids accountManager, but I am planning on making this for iOS so I want to use common practices for both.
What do you guys think?
General Questions:
Is refreshing an Oauth token the same as saying logging in again, or is it simply a new Oauth token?
Is there a way to get a unique id from a phone to detect if a "new phone" is in use?
Does anyone know how facebook or google handle their authentication/authorization on their devices? Do they simply just store an authentication token that never expires or when it does expire just issue a new one?
I guess Android apps seem vulnerable to me from a "what if someone found an exploit to pull authentication tokens without root access?" stand-point, am I wrong in thinking this?
Am I also wrong in believing that the only thing that would stop someone from accessing my account via api if they got my token, is if I access and used the api and it updated my Oauth to a new value to make my old one obsolete? (assuming there is no reliable way to tell which device is which)