Skip to content

Commit ed10c6b

Browse files
authored
Merge pull request #28 from salesforcecli/sm/stale-access-tokens
fix: refresh before reading files
2 parents 7fae20f + aa2e612 commit ed10c6b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/commands/force/org/display.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ export class OrgDisplayCommand extends SfdxCommand {
2727
};
2828

2929
public async run(): Promise<OrgDisplayReturn> {
30+
try {
31+
// the auth file might have a stale access token. We want to refresh it before getting the fields
32+
await this.org.refreshAuth();
33+
} catch (error) {
34+
// even if this fails, we want to display the information we can read from the auth file
35+
this.ux.warn('unable to refresh auth for org');
36+
}
3037
// translate to alias if necessary
3138
const authInfo = await AuthInfo.create({ username: this.org.getUsername() });
3239
const fields = authInfo.getFields(true);

0 commit comments

Comments
 (0)