I am using an app to login to a Drupal website. We are using Ionic v1. Angular version is 1.5.3 and angular-cookies version is 1.4.0.
After logging in, I need to save the session name and ID to a cookie for further authentication. So i am using ngCookies to save this session data to a cookie. My undertstanding is that I need to save the cookie with domain set to the domain of the Drupal website, which is local.mydomain.com. So I use this code a per the instructions on the ngCookie page (https://docs.angularjs.org/api/ngCookies/service/$cookies):
$cookies.put(key, value, {
'domain':'local.mydomain.com'
});
This doesn’t work, so I have tried using $cookiesProvider to set the default domain:
.config(['$cookiesProvider', function($cookiesProvider) {
// Set $cookies defaults
$cookiesProvider.defaults.domain = 'local.mydomain.com';
$cookiesProvider.defaults.path = '/';
}])
But this doesn’t work either. The domain is always saved as ‘localhost’.
Any help much appreciated.
Ionic info as follows:
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.4.0
Xcode version: Xcode 8.3.3 Build version 8E3004b