loadInWebView
Signs the current user in on the web and loads destination in webView.
Set up webView before you call this method, because it does not change the WebView:
Set
settings.javaScriptEnabled = true. The sign-in page runs a script.Set a
WebViewClientwithsetWebViewClient. Without one, the WebView hands the redirect that ends the sign-in to the system browser, and destination opens outside the app.
destination must be an absolute http or https URL. Every instance except a development instance requires https. A production instance also requires the host to be on one of the instance's domains.
Success means webView started loading the URL, not that the user was signed in. When the sign-in is refused, webView still lands on destination, with the query parameters __clerk_status=session_transfer_failed and __clerk_error_code. Check for them in WebViewClient.shouldOverrideUrlLoading, which sees every redirect, or on the page. onPageFinished misses them when destination redirects again, for example to its own sign-in page.
The WebView keeps its cookies after the native user signs out. Clear them with CookieManager.getInstance().removeAllCookies when the user signs out or switches accounts. Otherwise the next sign-in is refused and the page can show the previous user.
Return
Success once webView starts loading the URL, or a failure. The failure has the code invalid_arguments when destination is not an absolute http or https URL, signed_out when there is no active session, which includes a pending session, and session_changed when the active session changes before webView loads the URL.
Parameters
The WebView that loads the URL.
The web URL to land on after the user is signed in.