[英]Ember simple auth token authenticator
I am new to Ember and I'd like to use ember simple-auth library along with ember simple-auth-token.我是 Ember 的新手,我想将 ember simple-auth 库与 ember simple-auth-token 一起使用。 My problem is that I can't understand what to put in the authenticator variable.
我的问题是我无法理解在身份验证器变量中放入什么。 The code below is taken from the simple-auth-token readme on github.
下面的代码取自 github 上的 simple-auth-token 自述文件。
// app/controllers/login.js
import Ember from 'ember';
export default Ember.Controller.extend({
session: Ember.inject.service(),
actions: {
authenticate: function() {
var credentials = this.getProperties('identification', 'password'),
authenticator = 'authenticator:token';
this.get('session').authenticate(authenticator, credentials);
}
}
});
My server responds with a token that looks pretty much like this: {"auth_token":"f4f49eed1ddc43254c8a"}.我的服务器用一个看起来很像这样的令牌进行响应:{"auth_token":"f4f49eed1ddc43254c8a"}。
Should I change 'authenticator:token' to 'authenticator:auth_token'?我应该将“身份验证器:令牌”更改为“身份验证器:auth_token”吗? How exactly will the token value be passed to the authenticator?
令牌值究竟将如何传递给身份验证器?
Thanks in advance for your help!在此先感谢您的帮助!
The authenticator refers to which type of authenticator (token or JWT) should be used.身份验证器是指应使用哪种类型的身份验证器(令牌或 JWT)。
If you aren't using JWT tokens, then this issue is relevant to you: https://github.com/jpadilla/ember-simple-auth-token/issues/151如果您不使用 JWT 令牌,则此问题与您有关: https : //github.com/jpadilla/ember-simple-auth-token/issues/151
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.