Giter Club home page Giter Club logo

Comments (5)

fenichelar avatar fenichelar commented on May 29, 2024

@gwak while I have not personally tested it yet, I don't see any reason you can't use the latest version of ember-simple-auth-token with [email protected]. Are you running into any issues?

from ember-simple-auth-token.

edprats avatar edprats commented on May 29, 2024

I'm experiencing the same issue, for me its mostly that the "DataAdapterMixin" is deprecated which is causing lots of warnings in the new versions.

https://github.com/simplabs/ember-simple-auth/blob/master/guides/upgrade-to-v3.md#refactor-ember-data-adapters-to-remove-use-of-authorizers

from ember-simple-auth-token.

fenichelar avatar fenichelar commented on May 29, 2024

The ember-simple-auth-token mixins use the DataAdapterMixin. But you don't need to use the supplied mixins and probably shouldn't. With Octance, mixins aren't considering a good practice.

I have not had an opportunity to add text to the readme to describe how to use ember-simple-auth-token without the provided mixins. But the ember-simple-auth readme provides the information needed. Basically, do this in you adapter:

import { inject } from '@ember/service';
import { computed } from '@ember/object';
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  session: inject('session'),

  headers: computed('session.isAuthenticated', 'session.data.authenticated.token', function() {
    if (this.session.isAuthenticated) {
      return {
        Authorization: `Bearer ${this.session.data.authenticated.token}`,
      };
    } else {
      return {};
    }
  }),

  handleResponse(status) {
    if (status === 401 && this.session.isAuthenticated) {
      this.session.invalidate();
    }
    return this._super(...arguments);
  },
});

from ember-simple-auth-token.

edprats avatar edprats commented on May 29, 2024

Thank you, I was able to remove the token mixin use with this.

from ember-simple-auth-token.

fenichelar avatar fenichelar commented on May 29, 2024

I have updated the documentation: #299

from ember-simple-auth-token.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.