Skip to content

Commit 05160e8

Browse files
committed
Only try to authenticate when possible
1 parent c3b2309 commit 05160e8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/commands.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,14 @@ export class Commands{
245245
vscode.workspace.getConfiguration(),
246246
);
247247
constneedsToken=needToken(vscode.workspace.getConfiguration());
248-
try{
249-
constuser=awaitclient.getAuthenticatedUser();
250-
// For non-token auth, we write a blank token since the `vscodessh`
251-
// command currently always requires a token file.
252-
// For token auth, we have valid access so we can just return the user here
253-
return{token: needsToken&&token ? token : "",user };
254-
}catch(err){
255-
if(!needToken(vscode.workspace.getConfiguration())){
248+
if(!needsToken||token){
249+
try{
250+
constuser=awaitclient.getAuthenticatedUser();
251+
// For non-token auth, we write a blank token since the `vscodessh`
252+
// command currently always requires a token file.
253+
// For token auth, we have valid access so we can just return the user here
254+
return{token: needsToken&&token ? token : "", user };
255+
}catch(err){
256256
constmessage=getErrorMessage(err,"no response from the server");
257257
if(isAutoLogin){
258258
this.storage.output.warn(

0 commit comments

Comments
(0)