mercredi 24 février 2016

Send a DELETE request to serverTokenEndpoint using ember-simple-auth

I can set a custom endpoint for ember-simple-auth to obtain tokens. It sends an HTTP POST request to the custom endpoint.

export default OAuth2PasswordGrant.extend({
    serverTokenEndpoint:'/tokens'
});

I'd like to add a custom invalidate method that sends a DELETE to /tokens as well.

import Ember from 'ember';

export default Ember.Controller.extend({
    session: Ember.inject.service('session'),

    actions: {
        logout() {  
            this.get('session').invalidate();

            // DELETE to /tokens
        }
    }
});

Is this possible using an ember-simple-auth method? I can't see it working with ember data because there is no token model created in the first place. Or can this only be done with Ember.$.ajax or something like it?




Aucun commentaire:

Enregistrer un commentaire