@@ -2,7 +2,7 @@ import axios, { AxiosResponse } from "axios";
22import axiosCookieJarSupport from "axios-cookiejar-support" ;
33import tough = require( "tough-cookie" ) ;
44import * as vscode from "vscode" ;
5- import { IServerSpec } from "./extension" ;
5+ import { IServerSpec , smAPI } from "./extension" ;
66import * as https from 'https' ;
77
88const AUTHENTICATION_PROVIDER = "intersystems-server-credentials" ;
@@ -137,19 +137,21 @@ export async function makeRESTRequest(
137137}
138138
139139export async function resolveCredentials ( serverSpec : IServerSpec ) {
140- // This arises if setting says to use authentication provider
141- if ( typeof serverSpec . password === "undefined" ) {
140+ if ( typeof serverSpec . password === "undefined" && smAPI ) {
142141 const scopes = [ serverSpec . name , serverSpec . username || "" ] ;
142+
143+ // Handle Server Manager extension version < 3.8.0
144+ const account = smAPI . getAccount ? smAPI . getAccount ( serverSpec ) : undefined ;
143145 let session = await vscode . authentication . getSession (
144146 AUTHENTICATION_PROVIDER ,
145147 scopes ,
146- { silent : true } ,
148+ { silent : true , account } ,
147149 ) ;
148150 if ( ! session ) {
149151 session = await vscode . authentication . getSession (
150152 AUTHENTICATION_PROVIDER ,
151153 scopes ,
152- { createIfNone : true } ,
154+ { createIfNone : true , account } ,
153155 ) ;
154156 }
155157 if ( session ) {
0 commit comments