Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
feat(authService): optional logout request
Browse files Browse the repository at this point in the history
  • Loading branch information
doktordirk committed May 20, 2016
1 parent a8aad5f commit d65ca7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/authService.js
Expand Up @@ -239,13 +239,16 @@ export class AuthService {
* @return {Promise<>}
*/
logout(redirectUri) {
return new Promise(resolve => {
let localLogout = () => new Promise(resolve => {
this.authentication.responseObject = null;

this.authentication.redirect(redirectUri, this.config.logoutRedirect);

resolve();
});

return (this.config.logoutUrl
? this.client.request(this.config.logoutMethod, this.config.withBase(this.config.logoutUrl)).then(localLogout)
: localLogout());
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/baseConfig.js
Expand Up @@ -59,6 +59,10 @@ export class BaseConfig {
baseUrl = '';
// The API endpoint to which login requests are sent
loginUrl = '/auth/login';
// The API endpoint to which logout requests are sent (not needed for jwt)
logoutUrl = null;
// The HTTP method used for 'unlink' requests (Options: 'get' or 'post')
logoutMethod = 'get';
// The API endpoint to which signup requests are sent
signupUrl = '/auth/signup';
// The API endpoint used in profile requests (inc. `find/get` and `update`)
Expand Down

0 comments on commit d65ca7b

Please sign in to comment.