在DS.RESTAdapter上设置主机,删除ember-simple-auth标头

时间:2014-07-09 13:41:54

标签: ember.js ember-data ember-simple-auth

我正在使用带有ember-cli的ember-cli-simple-auth以及它运行良好的一切,直到我尝试在DS.RESTAdapter应用程序范围内设置新主机。

我一设置

// adapters/application.js
exports default DS.RESTAdapter.extend({
    host: 'https://api.example.com'
});

甚至使用reopen()它会清除ember-simple-auth设置的所有标题。

我是不是在ember-cli中设置了这个?

1 个答案:

答案 0 :(得分:2)

如果您为REST API使用不同的域,则需要为OAuth 2.0身份验证器配置(假设您正在使用它),并确保在服务器端启用了CORS。您可以在此处找到教程:http://log.simplabs.com/post/90339547725/using-ember-simple-auth-with-ember-cli