Ionic native http call with withCredentials


#1

Hello,

I am using ionic native http (4.5.2) with cordova-plugin-advanced-http (1.9.0).
But how I can make a post Request with withCredentials.
In angular http it can be configured in the RequestOptions. But how I can make it when using native. Please help?


#2

What exactly does that mean?


#3

in angular-http this means the following code…
let options = new RequestOptions({headers: headers, withCredentials: true});


#4

Yes, and what does that do? Why do you want to use that with Ionic Native HTTP?


#5

This has to do with cookies/jsessionid/…
Using withCredentials, the tokens get added to the header of the request. For authentication with the server


#6

I wanna mess up the performance between a http call by angular and native.
That’s why I want to test it both.
Is their any solution to make it native?
The next problem is when I use angular-http I sometimes run into a Cors issue on IOS device. This means it behaves differently after build for ios. Is anything wrong with my config.xml.

<access origin="*" />
 <allow-intent href="http://*/*" />
 <allow-intent href="https://*/*" />
 <allow-intent href="tel:*" />
 <allow-intent href="sms:*" />
 <allow-intent href="mailto:*" />
 <allow-intent href="geo:*" />
 <preference name="ScrollEnabled" value="false" />
 <preference name="android-minSdkVersion" value="16" />
 <preference name="BackupWebStorage" value="none" />
 <preference name="SplashMaintainAspectRatio" value="true" />
 <preference name="FadeSplashScreenDuration" value="300" />
 <preference name="SplashShowOnlyFirstTime" value="false" />
 <preference name="SplashScreen" value="screen" />
 <preference name="SplashScreenDelay" value="3000" />
 <allow-navigation href="http://*/" />
 <allow-navigation href="http://localhost:8080/*" />
 <platform name="ios">
     <allow-intent href="itms:*" />
     <allow-intent href="itms-apps:*" />
     <icon height="57" src="resources/ios/icon/icon.png" width="57" />
     <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
     <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
     <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
     <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
     <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
     <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
     <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
     <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
     <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
     <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
     <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
     <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
     <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
     <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
     <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
     <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
     <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
     <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
     <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
     <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
     <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
     <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
     <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
     <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
     <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
     <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
     <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
     <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
     <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
     <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
     <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
 </platform>
 <feature name="CDVWKWebViewEngine">
   <param name="ios-package" value="CDVWKWebViewEngine" />
 </feature>
 <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
 <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
 <plugin name="cordova-plugin-whitelist" spec="1.3.1" />
 <plugin name="cordova-plugin-device" spec="1.1.4" />
 <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
 <plugin name="cordova-plugin-ionic-webview" spec="^1.1.11" />
 <plugin name="cordova-plugin-wkwebview-engine" spec="^1.1.4" />