fenichelar/ember-simple-auth-token

TokenAuthorizerMixin error: "Assertion Failed: You're using the DataAdapterMixin without specifying an authorizer"

happycollision opened this issue · 9 comments

I get the following error message in my console at application load:

"Assertion Failed: You're using the DataAdapterMixin without specifying an authorizer. Please add authorizer: 'authorizer:application' to your adapter."

It occurs when my application adapter goes from this:

import DS from 'ember-data';

export default DS.JSONAPIAdapter.extend({
  namespace: '/api/v1',
})

to this:

import DS from 'ember-data';
import TokenAuthorizerMixin from 'ember-simple-auth-token/mixins/token-authorizer';

export default DS.JSONAPIAdapter.extend(TokenAuthorizerMixin, {
  namespace: '/api/v1',
})

What version of ember-simple-auth are you using?

Maybe I should add ember-simple-auth as a dependency to prevent older versions from being used. @jpadilla thoughts?

Nope. I just also get a deprecation warning along with it. Which makes sense since they said that it would be removed in 2.0.

Mmm... I don't see this behavior in any of my apps nor does it happen in the demo. What adapter functions are getting called on app boot?

No no no. My fault. I had an unsaved file.

So upgrading from ESA 1.5.1 to 1.6.0 does, in fact, fix the error. (I confirmed by downgrading and seeing the error again, as well.) So yes, it might be a good idea to tie ESAT to ESA ^1.6.0

Cool! I think it makes sense unless @jpadilla disagrees?

I went ahead and added it to #235.