mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 14:34:55 -07:00
Feat(security) - Make the OAuthTokenStorage non static (#7716)
Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
MCPServerStatus,
|
||||
mcpServerRequiresOAuth,
|
||||
getErrorMessage,
|
||||
MCPOAuthTokenStorage,
|
||||
} from '@google/gemini-cli-core';
|
||||
|
||||
const COLOR_GREEN = '\u001b[32m';
|
||||
@@ -141,9 +142,10 @@ const getMcpStatus = async (
|
||||
const { MCPOAuthTokenStorage } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const hasToken = await MCPOAuthTokenStorage.getToken(serverName);
|
||||
const tokenStorage = new MCPOAuthTokenStorage();
|
||||
const hasToken = await tokenStorage.getToken(serverName);
|
||||
if (hasToken) {
|
||||
const isExpired = MCPOAuthTokenStorage.isTokenExpired(hasToken.token);
|
||||
const isExpired = tokenStorage.isTokenExpired(hasToken.token);
|
||||
if (isExpired) {
|
||||
message += ` ${COLOR_YELLOW}(OAuth token expired)${RESET_COLOR}`;
|
||||
} else {
|
||||
@@ -385,11 +387,8 @@ const authCommand: SlashCommand = {
|
||||
|
||||
// Pass the MCP server URL for OAuth discovery
|
||||
const mcpServerUrl = server.httpUrl || server.url;
|
||||
await MCPOAuthProvider.authenticate(
|
||||
serverName,
|
||||
oauthConfig,
|
||||
mcpServerUrl,
|
||||
);
|
||||
const authProvider = new MCPOAuthProvider(new MCPOAuthTokenStorage());
|
||||
await authProvider.authenticate(serverName, oauthConfig, mcpServerUrl);
|
||||
|
||||
context.ui.addItem(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user