packages/ember-simple-auth/addon/authenticators/oauth2-password-grant.js
/**
    If token revocation is enabled, this will revoke the access token (and the
    refresh token if present). If token revocation succeeds, this method
    returns a resolving promise, otherwise it will return a rejecting promise,
    thus intercepting session invalidation.

    If token revocation is not enabled this method simply returns a resolving
    promise.

    @method invalidate
    @param {Object} data The current authenticated session data
    @return {Ember.RSVP.Promise} A promise that when it resolves results in the session being invalidated. If invalidation fails, the promise will reject with the server response (in case token revocation is used); however, the authenticator reads that response already so if you need to read it again you need to clone the response object first
    @public
  */
If token revocation is enabled, this will revoke the access token (and the
refresh token if present). If token revocation succeeds, this method
returns a resolving promise, otherwise it will return a rejecting promise,
thus intercepting session invalidation.

If token revocation is not enabled this method simply returns a resolving
promise.
If token revocation is enabled this will revoke the access token ( and the refresh token if present ) . If token revocation succeeds this method returns a resolving promise otherwise it will return a rejecting promise thus intercepting session invalidation . If token revocation is not enabled this method simply returns a resolving promise .
invalidate(data) {
    const serverTokenRevocationEndpoint = this.get('serverTokenRevocationEndpoint');
    function success(resolve) {
      cancel(this._refreshTokenTimeout);
      delete this._refreshTokenTimeout;
      resolve();
    }
    return new RSVP.Promise((resolve) => {
      if (isEmpty(serverTokenRevocationEndpoint)) {
        success.apply(this, [resolve]);
      } else {
        const requests = [];
        A(['access_token', 'refresh_token']).forEach((tokenType) => {
          const token = data[tokenType];
          if (!isEmpty(token)) {
            requests.push(this.makeRequest(serverTokenRevocationEndpoint, {
              'token_type_hint': tokenType, token
            }));
          }
        });
        const succeed = () => {
          success.apply(this, [resolve]);
        };
        RSVP.all(requests).then(succeed, succeed);
      }
    });
  }
invalidate ( data ) { const serverTokenRevocationEndpoint = this . get ( 'serverTokenRevocationEndpoint' ) ; function success ( resolve ) { cancel ( this . _refreshTokenTimeout ) ; delete this . _refreshTokenTimeout ; resolve ( ) ; } return new RSVP . Promise ( ( resolve ) => { if ( isEmpty ( serverTokenRevocationEndpoint ) ) { success . apply ( this , [ resolve ] ) ; } else { const requests = [ ] ; A ( [ 'access_token' , 'refresh_token' ] ) . forEach ( ( tokenType ) => { const token = data [ tokenType ] ; if ( ! isEmpty ( token ) ) { requests . push ( this . makeRequest ( serverTokenRevocationEndpoint , { 'token_type_hint' : tokenType , token } ) ) ; } } ) ; const succeed = ( ) => { success . apply ( this , [ resolve ] ) ; } ; RSVP . all ( requests ) . then ( succeed , succeed ) ; } } ) ; }
If token revocation is enabled, this will revoke the access token (and the
refresh token if present).
If token revocation is enabled this will revoke the access token ( and the refresh token if present ) .