【发布时间】:2015-01-26 20:50:23
【问题描述】:
所以我正在使用OAuth 2.0 扩展名设置ember-simple-auth。问题是每当我尝试登录并查看作为表单数据发送的内容时,它只发送grant_type 和password 参数。但是,password 参数始终为空,有时甚至不显示。 username参数总是不见了,至今没看到。
这是我的login.hbs 代码(顺便说一句,我使用的是 ember-cli)
<form {{action 'authenticate' on='submit'}}>
<label for="identification">Login</label>
{{input class="form-control" id='identification' placeholder='Enter Login' value=identification}}
<label for="password">Password</label>
{{input class="form-control" id='password' placeholder='Enter Password' type='password' value=password}}
<button type="submit">Login</button>
</form>
controllers 中的我的login.js 代码
import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
export default Ember.Controller.extend(LoginControllerMixin, {
authenticator: 'simple-auth-authenticator:oauth2-password-grant'
});
controllers 中的我的application.js 代码
// app/routes/application.js
import Ember from 'ember';
import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicationRouteMixin);
在我的config/environment.js 文件中
if (environment === 'development') {
…
ENV['simple-auth-oauth2'] = {
serverTokenEndpoint: '/api/v1/oauth/token'
}
…
}
It's making the call to the right url after this change
在我的初始化程序文件夹中
// app/initializers/simple-auth-config.js
export default {
name: 'simple-auth-config',
before: 'simple-auth',
initialize: function() {
window.ENV = FrontENV;
}
};
很容易注意到,大部分代码都是从simplelabs 上的教程复制而来,并进行了一些自定义。但是,我无法弄清楚为什么没有正确发送参数。任何帮助将不胜感激!
【问题讨论】:
-
您在 Ember Simple Auth 问题跟踪器上发布了或多或少相同的问题,并且已经获得了一些帮助。这解决了吗?如果是这样,您能否在此处添加答案并将其标记为已解决?
-
我会马上解决的。
-
一个月过去了... :)
标签: javascript ember.js oauth ember-simple-auth