Is there a way in ember to send cookies with the requests to the backend?
For example: if my client url is protocol://example.com . The cookies that belong to the same domain will be in the request header when I navigate to protocol://example.com/profile. However, they do not persist in the subsequent request/s the profile route model method makes -> example to protocol://example-host/posts . How do I make those cookies persist?
/app/routes/profile.js
import Ember from "ember";
import AuthenticatedRouteMixin from "simple-auth/mixins/authenticated-route-mixin";
export default Ember.Route.extend({
model: function () {
return this.store.findAll("post");
},
setupController: function (controller, model) {
// setup controller
},
renderTemplate: function () {
this.render("header", {
outlet: "header"
});
this.render("profile");
}
});
/app/adapters/application
import Ember from "ember";
import DS from "ember-data";
export default DS.RESTAdapter.extend({
host: http://example-host.com,
corsWithCredentials: true,
crossDomain: true,
xhrFields: {withCredentials: true},
});
Aucun commentaire:
Enregistrer un commentaire