-1

Here is my code:

"ember-simple-auth": "^1.6.0"

"ember-cli": "^3.1.4"


export default ActiveModelAdapter.extend(DataAdapterMixin, {
  host: ENV.APP.API_HOST,  
  authorizer: 'authorizer:devise',
...

How can I fix deprecation warning ?

AdminDev826
  • 330
  • 4
  • 15
  • The deprecation comes with a [link to the documentation](https://github.com/simplabs/ember-simple-auth#deprecation-of-authorizers) explaining how to fix it, give it a look. – Patsy Issa May 31 '18 at 12:35
  • I'm voting to close this question as off-topic because the solution is provided by the addon authors within the deprecation message. – Patsy Issa May 31 '18 at 12:35

1 Answers1

2

I have fixed this issue. See the examples in the documentation.

authorize(xhr) {
    let { email, token } = this.get('session.data.authenticated');
    let authData = `Token token="${token}", email="${email}"`;
    xhr.setRequestHeader('Authorization', authData);
}

Use above code instead of authorizer: 'authorizer:devise'.

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
AdminDev826
  • 330
  • 4
  • 15