なので拡張機能ember-simple-authを使って設定しています。OAuth 2.0問題は、ログインしてフォーム データとして送信されているものを確認しようとするたびに、grant_typeandpasswordパラメータのみが送信されることです。ただし、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>
私のlogin.jsコードcontrollers
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'
});
私のapplication.jsコードcontrollers
// 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いくつかのカスタマイズが加えられていることに気付くのは簡単です。ただし、パラメーターが正しく送信されない理由がわかりません。どんな助けでも大歓迎です!