onReceivedHttpAuthRequest method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebViewClient.onReceivedHttpAuthRequest', apiUrl: 'https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)'), IOSPlatform(apiName: 'WKNavigationDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview'), MacOSPlatform(apiName: 'WKNavigationDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview'), WindowsPlatform(apiName: 'ICoreWebView2_10.add_BasicAuthenticationRequested', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_10?view=webview2-1.0.2849.39#add_basicauthenticationrequested')])
FutureOr<HttpAuthResponse?>? onReceivedHttpAuthRequest(
  1. HttpAuthenticationChallenge challenge
)

Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.

challenge contains data about host, port, protocol, realm, etc. as specified in the URLAuthenticationChallenge.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • challenge: all platforms

Use the PlatformInAppBrowserEvents.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebViewClient.onReceivedHttpAuthRequest',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)',
    ),
    IOSPlatform(
      apiName: 'WKNavigationDelegate.webView',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview',
    ),
    MacOSPlatform(
      apiName: 'WKNavigationDelegate.webView',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview',
    ),
    WindowsPlatform(
      apiName: 'ICoreWebView2_10.add_BasicAuthenticationRequested',
      apiUrl:
          'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_10?view=webview2-1.0.2849.39#add_basicauthenticationrequested',
    ),
  ],
)
FutureOr<HttpAuthResponse?>? onReceivedHttpAuthRequest(
  HttpAuthenticationChallenge challenge,
) {
  return null;
}