My ionic/cordova app now gives errors when used with HTTPS backend
`The certificate for this server is invalid`
I am in my development environment, use self-signed certificates, and use IP address to connect with the backend.
I examined the certificate using openssl s_client
and it looks valid. As a matter of fact I am able to use the same backend with android version of this hybrid app.
Is there some plist
or other Xcode
setting to accept a self-signed certificate or ignore this test all together - similar to NSAppTransportSecurity::NSAllowsArbitraryLoads
setting?
--EDIT
I have <access origin="*"/>
in my config.xml
file.
Thanks a lot
If you want to turn on SSL/TLS trust for that certificate, go to Settings > General > About > Certificate Trust Settings. Under "Enable full trust for root certificates," turn on trust for the certificate. Apple recommends deploying certificates via Apple Configurator or Mobile Device Management (MDM).
A certificate is self-signed if the subject and issuer match. A certificate is signed by a Certificate Authority (CA) if they are different. To validate a CA-signed certificate, you also need a CA certificate.
You can add this at the end of AppDelegate.m, but just for testing purposes, you should remove it before releasing the app, apple might not approve the app if it contains that code
@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
return YES;
}
@end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With