Search code examples
ember.jsember-simple-auth

Ember Simple Auth: Session - no authorize method?


I am reading documentation of the Ember Simple Auth. I want to send authorized ajax request (outside of the Ember store).

I've found out there is a method for that. However when I try it to call inside my component, I get error "TypeError: this.get(...).authorize is not a function". What am I doing wrong?

Here's my code:

import Ember from "ember";

export default Ember.Component.extend({
    session: Ember.inject.service('session'),
    actions: {
        del: function() {
            var self = this;
            console.log(this.get('session'));
            this.get('session').authorize('authorizer:oauth2-bearer', function(header, content) {
                ...
            });
        }
    }
});

Solution

  • One rule you should apply when you upgrade ember plugin - make sure the older NPM version is uninstalled properly - or you will have many, many problems like I had.

    Uninstalling the older version completly solved my problem.