How To Add Authorization Bearer Header To Webview Android?
I have to send bearer at headers. I saw that I have to add hashMap with values:
val headerMap = HashMap<String, String>() headerMap["Authorization: Bearer "] = context!!.getSharedPreferences("app_data", 0).getString("access_token", "")!!
and then send data with url:
but as a result I see that I send the wrong format of this token:
How I can fix it because with that token I can't get data from page?
Can you try to do it this way
val bearer = "Bearer " + context!!.getSharedPreferences("app_data", 0).getString("access_token", "")!! val headerMap = HashMap<String,String>() headerMap["Authorization"] = bearer webView.loadUrl(link, headerMap)
You need to think, you are using a
HashMap so, means it has a
Key and a
Key is the
Header name and then the
Value is the value of that
Header name so in this case is :
Header name -->
Header value -->
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View