Ember数据django rest适配器授权jwt

时间:2015-01-14 09:11:04

标签: ember.js django-rest-framework jwt

我正在使用ember-simple-auth和ember-simple-auth-token来实现客户端会话机制。我的后端是django(DRF + DRF jwt),我正在使用ember-django-adapter。我定义了一个路由用户,一个模型用户但是当我尝试去http://myhost/users时我有这个错误:

Error while processing route: users.index Authentication credentials were not provided. Error: Authentication credentials were not provided.

如何在发出http请求时告诉django适配器添加特定的授权令牌(从ember-simpe-auth会话中获取)?

谢谢。

PS:我添加到config \ environment.js这段代码

ENV['simple-auth'] = {
  authorizer: 'simple-auth-authorizer:token'
};

ENV['simple-auth-token'] = {
  serverTokenEndpoint: 'http://myhost/api/jwt-auth/',
  identificationField: 'username',
  tokenPropertyName: 'token',
  authorizationPrefix: 'JWT',
  authorizationHeaderName: 'Authorization',
};

0 个答案:

没有答案