-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ember-simple-auth data adapter mixin doesn't work with Ember 3.13 without jQuery #1961
Comments
This solution works for me as ember data use fetch now. app/adapters/application.js import { computed } from '@ember/object';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend(DataAdapterMixin, {
headers: computed('session.data.authenticated.token', function () {
if (this.session.isAuthenticated) {
return { 'Authorization': 'Bearer ' + this.session.data.authenticated.token };
}
})
}); |
@oliverlj in your OPTIONS requests you must send authorization header too? |
I don't use options request for the moment |
the mixins are not a part of octane anymore...so what can we do about that? |
@theloosecannon this is what i'm currently trying to work with class ApplicationAdapter extends JSONAPIAdapter { export default ApplicationAdapter.extend(DataAdapterMixin, { |
Is possible to use ES6 classes with mixins (it works for every kind of class, component, model...): export default class ApplicationAdapter extends JSONAPIAdapter.extend(DataAdapterMixin) {
// your code
} |
Closing this as all mixins are deprecated now – see #2198 |
I used
ember-cli-update
to update a project to EmberJS 3.13 which removes jQuery. This causes thebeforeSend
hook in the data adapter mixin to not be called and thus the token fromember-simple-auth-token
to not be sent with any EmberData requests.To work around this problem, I added the
@ember/jquery
module back and enabled jquery integration inoptional-features.json
.I found: https://stackoverflow.com/questions/55180689/ember-simple-auth-and-ember-fetch-no-authorization-in-fetch-query but I couldn't get that to work. I did get authorization to work without jQuery by:
The text was updated successfully, but these errors were encountered: