emma93
emma93

Reputation: 187

POST Request from iOS (AJAX, https)

I'm trying to make an AJAX POST Request from my iOS (Cordova) App. The API URL has a secure certificate on www.myDomain.ch but not without www. When I test the Request with a tool everything works. I also tried it in a React test application, and it worked. Only from my iOS App the Request causes in a 403 error. I've tried it with jQuery Ajax, fetch and axios. The Backend also has CORS enabled.

My AJAX call looks like:

$.ajax({
   url: 'myurl',
   data: JSON.stringify(dataObject),
   method: 'POST',
   dataType: 'json',
   success: function(data) {
      console.log('success', data);
   },
   error: function(err) {
      console.log('error', err);
   }
});

Requires iOS a special https certificate or is there something I have to add in the Request Header?

Upvotes: 1

Views: 1505

Answers (1)

TheBasicMind
TheBasicMind

Reputation: 3585

You probably need to declare the domain in your plist file for your app to meet iOS App Transport Security requirements. See this link:

App Transport Security

Upvotes: 1

Related Questions