Can I use Android WebView object for Google Authentication?

I'm using Android Studio to update a login page that authenticates via Google. In the onCreate method, I have a function, called loadWebViewPage(), that loads up our authentication page that uses Google for auth. When loadWebViewPage() is called I have the following:

private void loadWebViewPage()

CookieManager cookieManager = CookieManager.getInstance();
String userAgent = "Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Mobile Safari/535.19";
//Set WebView
WebView webView =(WebView)findViewById(;
webView.setWebViewClient(new WebViewClient());
//Set WebSettings
WebSettings webSettings = webView.getSettings();


webView.loadUrl("the url that redirects to sso page");

Toolbar toolbar = (Toolbar) findViewById(;

new IntentFilter(LoginHelper.LOGIN_MESSAGE));


The onCreate method works fine; I get the page to load, users can enter their email and password. However when the users clicks the login button it does not want to load in Google authentication where they should be able to select which Google account they want to log in with.

This line webView.loadUrl("the url that redirects to sso page") loads up a vendor hosted page that handles the sso authentication. If user enters an invalid email or incorrect email/password combination it does not allow them to proceed forward and presents a "login error' message.
If user enters a valid Google email that is in the system linked by a userID, then it is supposed to present them with the Google option to either enter their password or select the appropriate Google account if they are logged into multiple Google accounts.

I tried looking for a solution and what I've seen is the User Agent or Google doesn't support Webviews anymore to I need to setup a browser that handles auth then go back into app on successful login.

I'm thinking the easiest solution would be to update the the User Agent variable. However, am I missing something or should be approaching this differently? I don't want to load an actual browser as we don't want users messing with the url address or having to worrying about the navigation buttons.

Last edited: