I am developing a native app that uses OAuth2 for user authentication to a web app. When user asks for authentication, the system browser starts via
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(myLinkHere))
, the login page is displayed, user inserts their username/password and the access_token
is returned to the app.
My problem is that when the user has saved their credentials in the browser and an authentication request comes about, then the browser starts momentarily and the flow returns to the app right away. Is there any way to hide from the user the opening of the browser or to open it in background so as to avoid this bad user experience?