Skip to content

Commit

Permalink
Merge pull request #3 from auth0-training/fix/flush-tokenset-on-auth-…
Browse files Browse the repository at this point in the history
…change

fixed an issue that cases old tokenset to be used when switching tenants
  • Loading branch information
Bobby Johnson authored Sep 9, 2021
2 parents f84485f + 86e9d42 commit a5e1cd9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how


### Changed
- Updated dependencies
- Updated dependencies

## [1.1.2] - 2021-09-09
### Changed
- fixed bug that caused incorrect tokenset to be used when switching tenants.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-labs",
"preview": true,
"displayName": "Auth0 Labs",
"version": "1.1.1",
"version": "1.1.2",
"description": "A Visual Studio Code extension for training lab automation and quick access to tenant information.",
"main": "./dist/extension.js",
"publisher": "auth0",
Expand Down
6 changes: 5 additions & 1 deletion src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import type { TokenSet } from 'openid-client';
import { Auth } from '../auth';

let managementClient: ManagementClient;
let tokenSet: TokenSet;
let tokenSet: TokenSet | undefined;

Auth.onAuthStatusChanged(async (newTokenSet) => {
tokenSet = newTokenSet;
});

export async function getClient(): Promise<ManagementClient> {
if (!tokenSet || tokenSet?.expired()) {
Expand Down

0 comments on commit a5e1cd9

Please sign in to comment.