This is a screenshot from google chrome. When I try to access a page with basic authentication, this authentication dialog is shown. I want this feature be enabled in my android Webview as well and let the user enter their username and password. But instead it just shows the 401 unauthorized page without showing this popup. How would I achieve this in the Webview? I have tried adding these snippets but still unable to show this popup.
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setSupportZoom(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webview.getSettings().setSupportMultipleWindows(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setDatabaseEnabled(true);
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setSaveFormData(true);
webview.getSettings().setMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW);
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setAllowFileAccessFromFileURLs(true);
webview.getSettings().setAllowUniversalAccessFromFileURLs(true);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

You need to override WebViewClient.onReceivedHttpAuthRequest() to handle the authentication. Your code is responsible for showing the authentication dialog or retrieving saved username/password. This will not be done for you.
This is the code that worked in my app. I remove some parts of it for clarity.