code: private void prepareWebView() {
          mWebView.getSettings().setJavaScriptEnabled(true);
          mWebView.setVisibility(View.VISIBLE);
          mWebView.setWebViewClient(new WebViewClient() {
  
              private boolean done = false;
  
              @Override
              public void onPageFinished(WebView view, String url) {
                  // Catch the redirect url with the parameters added by the provider auth web page
                  if (!done && url.startsWith(mAppInfo.getRedirectUrl())) {
                      done = true;
                      getCredentials(url);
                      mWebView.setVisibility(View.INVISIBLE);
                  }
              }
          });
      }
docs: Adds a callback on the web view to catch the redirect URL