MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / ensureAuthenticated

Method ensureAuthenticated

src/api/providers/qwen-code.ts:174–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 }
173
174 private async ensureAuthenticated(): Promise<void> {
175 if (!this.credentials) {
176 this.credentials = await this.loadCachedQwenCredentials()
177 }
178
179 if (!this.isTokenValid(this.credentials)) {
180 this.credentials = await this.refreshAccessToken(this.credentials)
181 }
182
183 // After authentication, update the apiKey and baseURL on the existing client
184 const client = this.ensureClient()
185 client.apiKey = this.credentials.access_token
186 client.baseURL = this.getBaseUrl(this.credentials)
187 }
188
189 private getBaseUrl(creds: QwenOAuthCredentials): string {
190 let baseUrl = creds.resource_url || "https://dashscope.aliyuncs.com/compatible-mode/v1"

Callers 2

createMessageMethod · 0.95
completePromptMethod · 0.95

Calls 5

isTokenValidMethod · 0.95
refreshAccessTokenMethod · 0.95
ensureClientMethod · 0.95
getBaseUrlMethod · 0.95

Tested by

no test coverage detected