Skip to content

Commit

Permalink
Store github token in session storage, remove on logout
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Shumilova <ashumilo@redhat.com>
  • Loading branch information
ashumilova committed Jul 22, 2019
1 parent 9484d98 commit 6a93765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dashboard/src/components/api/che-keycloak.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export class CheKeycloak {
}

logout(): void {
window.sessionStorage.setItem('oidcDashboardRedirectUrl', location.href);
window.sessionStorage.removeItem('githubToken');
window.sessionStorage.setItem('oidcDashboardRedirectUrl', location.href);
this.keycloak.logout({});
}

Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/components/github/github-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ export class GitHubService {
.factory('gitHubTokenStore', function () {
return {
setToken: function (token: string) {
localStorage.setItem('gitHubToken', token); // jshint ignore:line
sessionStorage.githubToken = token;
},
getToken: function () {
return localStorage.getItem('gitHubToken'); // jshint ignore:line
return sessionStorage.githubToken;
}
};
}).factory('gitHubApiUtils', ['gitHubApiUrlRoot', function (gitHubApiUrlRoot: string) {
Expand Down

0 comments on commit 6a93765

Please sign in to comment.