Skip to content

Commit d7c8c88

Browse files
committed
code clean up
1 parent d4f5e0d commit d7c8c88

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

extensions/authentication/src/positOAuthProvider.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as vscode from 'vscode';
77
import * as positron from 'positron';
8-
import { POSIT_AUTH_PROVIDER_ID } from './constants';
8+
import { POSIT_AUTH_PROVIDER_ID, CREDENTIAL_REFRESH_INTERVAL_MS } from './constants';
99
import { log } from './log';
1010

1111

@@ -201,8 +201,7 @@ export class PositOAuthProvider implements vscode.AuthenticationProvider, vscode
201201
throw new Error('No Posit AI access token found. Please sign in.');
202202
}
203203

204-
const tenMin = 10 * 60 * 1000;
205-
const expiry = parseInt(tokenExpiry) - tenMin;
204+
const expiry = parseInt(tokenExpiry) - CREDENTIAL_REFRESH_INTERVAL_MS;
206205
if (Date.now() >= expiry) {
207206
const result = await this.refreshAccessToken();
208207
if (!result.success) {

extensions/positron-assistant/src/providers/posit/positProvider.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ export class PositModelProvider extends VercelModelProvider {
113113
* Only attaches the token for URLs matching the configured baseUrl.
114114
*/
115115
private async authFetch(input: RequestInfo, init?: RequestInit): Promise<Response> {
116-
const url = typeof input === 'string' ? input : input.url;
117-
const baseUrl = this.baseUrl;
118-
if (!url.startsWith(baseUrl)) {
119-
return fetch(input, init);
120-
}
121116
const token = await this.getAccessToken();
122117
const headers = new Headers(init?.headers);
123118
headers.set('Authorization', `Bearer ${token}`);

0 commit comments

Comments
 (0)