Hello, i try to fetch a xcrsf Token and it's working great when i disable
the cors in localhost.
var deferred = $q.defer();
$http({
url: reservationsEndPoint,
method: 'GET',
withCredentials: true,
headers:
{'X-CSRF-Token':'Fetch'},
timeout:5000,
}).then(function (response) {
// console.log(response.headers('x-csrf-token'));
// var xcsrfToken = response.headers('x-csrf-token');
// xcsrfToken = response.headers('x-csrf-token');
deferred.resolve(response);
}, function (error) {
deferred.reject(error.data.error.message.value);
});
return deferred.promise;
But when i try with cors enabled, preflight call options are made
automaically by browser :
And when i try to fetch the token from the response, i get nothing because
of the options!
Thank you for your help
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.