Aston13 edited a comment on issue #922:
URL: https://github.com/apache/cordova-ios/issues/922#issuecomment-792708650


   > FWIW I managed to get my Cordova app to use authentication cookies set by 
the response of an XHR request to my remote without needing any plugins or 
hacks. There are some gotchas though and wanted to try to outline them here:
   > 
   > * Add CORS headers to your remote that allow the origin defined by your 
`scheme` and `hostname` in config.xml (eg. `foo://mydomain.com`), allow CORS 
headers, and make sure you're returning 200 for OPTIONS requests even though 
they won't have authentication cookies
   > * Set `withCredentials: true` on your XHR requests
   > * Add your remote to  `WKAppBoundDomains` in your app's plist file
   > * Opt into `limitsNavigationsToAppBoundDomains = YES` in 
`CDVWebViewEngine.m`
   > 
   > The last two aren't ideal, and I've created a[ feature request for 
cordova-ios to handle 
AppBoundDomains](https://github.com/apache/cordova-ios/issues/1088) out of the 
box. If you're up against a deadline however, it's not too painful to add it 
yourself
   
   I have just taken over development of an app this week (with little app 
experience) as the previous developer left. Since he left, iOS login 
authentication fails - I believe this stems from when the previous dev updated 
XCode from 11 -> 12 two weeks ago. I have been following the posts here and on 
webkit for the past few days and still haven't found a solution, not even with 
the AppBoundDomains. 
   
   Login works fine on browser and Android. Only on iOS devices and on the 
simulator/emulator it fails due to cookies. The only successful login I have 
managed to achieve on iOS is by adding this to the config.xml:
   
       <preference name="scheme" value="https" />
       <preference name="hostname" value="domain.com" />
       
   However, this only works for a single domain, and I need to support multiple.
   
   feelsbadman.jpg
   
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to