I want to load a URL in a WebView and add headers User-Agent and autoToken.
I have tried to just have val map = HashMap<String, String>() and add it as webview.loadUrl(url, map).
The second try was to just override shouldInterceptRequest().
override fun shouldInterceptRequest(view: WebView?, request: WebResourceRequest): WebResourceResponse? {
request.requestHeaders?.put(LegacyAuthInterceptor.HEADER_AUTH_TICKET, autoToken)
request.requestHeaders?.put("User-Agent", userAgent)
return super.shouldInterceptRequest(view, request)
}
None of these solutions are working.