lundi 29 juin 2015

My ember-simple-auth authenticator cannot call super. Why is that?

I'm trying to implement an authenticator such that it will let me send a client_id with OAuth. In app/authenticators/oauth-custom.js:

import Authenticator from 'simple-auth-oauth2/authenticators/oauth2';

export default Authenticator.extend({
  makeRequest: (url,  data) => {
    data.client_id = EmberENV.clientId;
    return this._super(url, data);
  }
});

This however generate an error when I attempt to sign in:

TypeError: Cannot read property '_super' of undefined

The source map seem to suggest that _this is set to be undefined.

define('frontend/authenticators/oauth-custom', ['exports', 'simple-auth-oauth2/authenticators/oauth2'], function (exports, Authenticator) {

  'use strict';

  var _this = undefined;

  exports['default'] = Authenticator['default'].extend({
    makeRequest: function makeRequest(url, data) {
      data.client_id = EmberENV.clientId;
      return _this._super(url, data);
    }
  });
});

I'm using the current latest ember-cli 0.2.7, ember 1.13.2, ember-simple-auth 0.8.0. What's the issue?




Aucun commentaire:

Enregistrer un commentaire