Ember-simple-auth: Authorize error/deprecation in 2.1.0 can't be removed

Created on 2 Dec 2019  路  4Comments  路  Source: simplabs/ember-simple-auth

I'm trying to upgrade our apps to 2.1.0. When doing so I see the following deprecation:

WARN: DEPRECATION: Ember Simple Auth: The authorize method should no longer be used. Instead, set the headers property or implement it as a computed property. [deprecation id: ember-simple-auth.data-adapter-mixin.authorize]

So I follow the upgrade guide and replace the authorize function with a header computed prop on the adapter. Now I continue to get the deprecation above and the following error:

ERROR: Error while processing route: index Assertion Failed: The `authorize` method should be overridden in your application adapter. It should accept a single argument, the request object. Error: Assertion Failed: The `authorize` method should be overridden in your application adapter. It should accept a single argument, the request object.

Not sure how to move forward with the upgrade. Thanks!

Most helpful comment

All 4 comments

I have exactly this issue.

My current work around is to add a stub authorize method, this removes the error but gives me the annoying deprecation warning.

authorize(request) {
  console.log("overriding authorize method because reasons");
}

This is because of following change 0169ee977e2094ac87c8971324a1910bd9b798b2. The deprecation is in the else if authorizer-property is not set. I did not found a solution yet. Overwriting ajaxOptions-method in your adapter does not work, because you need the execution of ember.js-Adapter::ajaxOptions. Therefore you cannot skip DataAdapterMixin::ajaxOptions.

I think we need a release of ember-simple-auth 3

This has already been addressed in https://github.com/simplabs/ember-simple-auth/pull/2010. We can probably expect this fix in v2.2.0

Was this page helpful?
0 / 5 - 0 ratings