ember-simple-auth facebook 身份验证器

ember-simple-auth facebook authenticator

正在尝试为我的应用连接 facebook 身份验证。我的后端工作正常,但我的验证器(我认为这是问题所在)总是返回 undefined

ember-simple-auth 复制示例,第 23 行的控制台日志从未被调用,让我想到其他问题?

import Ember from 'ember';
import Torii from 'ember-simple-auth/authenticators/torii';

const {inject: {service}} = Ember;

export default Torii.extend({
  torii: service(),
  ajax: service(),

  authenticate() {
    const ajax = this.get('ajax');

    return this._super(...arguments).then((data) => {
      return ajax.request('http://localhost:8080/api/login', {
        type: 'POST',
        dataType: 'application/json',
        data: {
          'grant_type': 'facebook_auth_code',
          'auth_code': data.authorizationCode
        }
      }).then((response) => {

        console.log("CALLED!");

        return {
          access_token: response,
          provider: data.provider
        };
      });
    });
  }
});

服务器的响应是来自facebook的access_token;

我怎样才能更好debug/solve这是怎么回事?

问题实际上是使用 dataType 的一个简单错误。应该是 dataType: 'json' 而不是 dataType: 'application/json'