Skip to main content
Glama

Google Workspace MCP Server

get-refresh-token.js1.09 kB
import { google } from 'googleapis'; import { authenticate } from '@google-cloud/local-auth'; import { writeFileSync } from 'fs'; import { join } from 'path'; const SCOPES = [ 'https://www.googleapis.com/auth/gmail.modify', 'https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/gmail.send' ]; async function getRefreshToken() { try { // Authenticate using local OAuth client const auth = await authenticate({ scopes: SCOPES, keyfilePath: join(process.cwd(), 'credentials.json') }); // Get credentials including refresh token const credentials = auth.credentials; console.log('\nRefresh Token:', credentials.refresh_token); console.log('\nClient ID:', credentials.client_id); console.log('\nClient Secret:', credentials.client_secret); // Save credentials to a file writeFileSync('token.json', JSON.stringify(credentials, null, 2)); console.log('\nCredentials saved to token.json'); } catch (error) { console.error('Error getting refresh token:', error); } } getRefreshToken();

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rishipradeep-think41/gsuite-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server