简体   繁体   English

Ember 简单的身份验证令牌身份验证器

[英]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.

相关问题 实现自定义ember-simple-auth身份验证器 - Implementing a custom ember-simple-auth Authenticator ember-simple-auth facebook身份验证器 - ember-simple-auth facebook authenticator Ember简单身份验证和Ember简单身份验证令牌 - Ember Simple Auth & Ember Simple Auth Token EmberJS从ember-simple-auth身份验证器检索当前用户 - EmberJS retrieve current user from ember-simple-auth authenticator Django rest + ember simple auth身份验证器“ authenticator:oauth2”被拒绝恢复会话-无效 - Django rest + ember simple auth The authenticator “authenticator:oauth2” rejected to restore the session - invalidating Ember-Simple-Auth自定义的Devise Authenticator serverTokenEndpoint默认为用户/登录 - Ember-Simple-Auth customised Devise Authenticator serverTokenEndpoint defaulting to users/sign_in 使用ember-cli-simple-auth-token配置ember-simple-auth - Configuring ember-simple-auth with ember-cli-simple-auth-token Ember引擎和Ember简单Auth - Ember engines and Ember simple Auth 使用ember-cli和ember-simple-auth的POST /令牌400(错误请求) - POST /token 400 (Bad Request) with ember-cli and ember-simple-auth 如果身份验证器中的身份验证令牌已过期,请使用刷新令牌 - Use refresh token if auth token expired in account authenticator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM