If you have an API and run it on Laravel Valet, you may get errors about SSL ceritifate when you do a call to the API.
An example error you may see:
- Network request failed: The certificate for this server is invalid. You might be connecting to a server that is pretending to be [your local domain] which could put your confidental information at risk.
-1- edit ~/.composer/vendor/laravel/valet/cli/stubs/openssl.conf Change: basicConstraints = CA:FALSE
To: basicConstraints = CA:TRUE,pathlen:0
save file.
-2- go to your website folder, run: valet secure
-3- drag ~/.valet/Certificates/[website.domain].crt to iOS simulator to add it there.
-4- From iOS simulator, - go to Settings->about->Certificates Trust Settings
-5- drag ~/.valet/CA/LaravelValetCASelfSigned.pem to iOS simulator to add it there.
-6- From iOS simulator, - go to Settings->about->Certificates Trust Settings - Enable Full Trust for your website cert.
-7- add the snippet below /app/App_Resources/iOS/Info.plist file in your NativeScript project:
'NSAppTransportSecurity NSAllowsArbitraryLoads '
Use it just for local development. App Store guideline doesn't allow to publish an app with this setting.
-8- run 'tns platform clean ios', close simulator and re-build / run it.
Enjoy
Please note that this might still give you headaches because of the issue mentioned here: laravel/valet#1103
Laravel Valet's root certificate (LaravelValetCASelfSigned) is only valid for 2 years after the initial creation. I'm just trying to renew it without completely purging the Valet installation.