This might have been duplicate, as there are many similar question on SO, but I haven't find my answer on any of other questions..
I have an Android/iOS client apps and a server that provides resources to the client apps. Client communicates with server via REST api. Android/iOS app requires logged user for it's work.
My (wishful) scenario is:
User opens Android app for the first time. User enters his credentials (username, password). App checks credentials with the server and if everything ok user enters the app, app now has all permissions to get user resources and to send updates to/from server etc. User should not need to reenter his credentials ever again (or at least not for a long time).
How can I make this scenario secure?
I am investigating OAuth 2.0 and other token based authentication methods/protocols, and there are some things I don't understand:
If Android client is not considered safe place to store any secret - how can I keep any token (access or refresh) for a long time without user being forced to reenter credentials?