Skip to main content
Glama
peakmojo

Zoom Recordings No-Auth

by peakmojo

zoom_refresh_token

Renew Zoom OAuth2 access tokens using refresh tokens and client credentials to maintain uninterrupted API access for Zoom Recordings No-Auth server.

Instructions

Refresh the Zoom OAuth2 access token using the refresh token and client credentials for API access

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zoom_access_tokenNoZoom OAuth2 access token (optional if expired)
zoom_client_idYesZoom OAuth2 client ID for token refresh
zoom_client_secretYesZoom OAuth2 client secret for token refresh
zoom_refresh_tokenYesZoom OAuth2 refresh token

Implementation Reference

  • Handler function for the 'zoom_refresh_token' tool. Instantiates ZoomClient with provided tokens and calls refreshAccessToken method.
    async ({ zoom_access_token, zoom_refresh_token, zoom_client_id, zoom_client_secret }) => { try { const zoom = new ZoomClient({ accessToken: zoom_access_token, refreshToken: zoom_refresh_token }); const result = await zoom.refreshAccessToken(zoom_client_id, zoom_client_secret); return { content: [{ type: 'text', text: result }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ error: error.message, status: 'error' }) }] }; } }
  • Zod schema defining input parameters for the zoom_refresh_token tool.
    zoom_access_token: z.string().optional().describe('Zoom OAuth2 access token (optional if expired)'), zoom_refresh_token: z.string().describe('Zoom OAuth2 refresh token'), zoom_client_id: z.string().describe('Zoom OAuth2 client ID for token refresh'), zoom_client_secret: z.string().describe('Zoom OAuth2 client secret for token refresh') },
  • server.js:305-305 (registration)
    Registration of the zoom_refresh_token tool using server.tool().
    'zoom_refresh_token',
  • ZoomClient method that performs the actual token refresh by making POST to Zoom OAuth endpoint.
    async refreshAccessToken(clientId, clientSecret) { logger.debug(`Starting refreshAccessToken with clientId=${clientId?.slice(0, 5)}...`); if (!this.refreshToken) { return JSON.stringify({ error: "No refresh token provided", status: "error" }); } try { this.clientId = clientId; this.clientSecret = clientSecret; const authHeader = Buffer.from(`${clientId}:${clientSecret}`).toString('base64'); const headers = { "Authorization": `Basic ${authHeader}`, "Content-Type": "application/x-www-form-urlencoded" }; const data = { grant_type: "refresh_token", refresh_token: this.refreshToken }; logger.debug(`Making POST request to Zoom OAuth token endpoint with refreshToken=${this.refreshToken.slice(0, 10)}...`); const response = await axios.post( "https://zoom.us/oauth/token", data, { headers } ); logger.debug(`Received response with status code: ${response.status}`); if (response.status === 200) { const result = response.data; logger.debug("Successfully refreshed token"); this.accessToken = result.access_token; this.refreshToken = result.refresh_token || this.refreshToken; const expiresIn = result.expires_in || 3600; const expiry = DateTime.now().plus({ seconds: expiresIn }); return JSON.stringify({ access_token: this.accessToken, refresh_token: this.refreshToken, expires_at: expiry.toISO(), expires_in: expiresIn, status: "success" }); } else { logger.error(`Failed to refresh token: ${response.status}, Response: ${response.data}`); return JSON.stringify({ error: `Failed to refresh token. Status code: ${response.status}`, details: response.data, raw_response: response.data, status: "error" }); } } catch (error) { logger.error(`Exception in refreshAccessToken: ${error.message}`); return JSON.stringify({ error: error.message, status: "error" }); } }
  • Handler logic within handle_call_tool for executing zoom_refresh_token tool.
    if name == "zoom_refresh_token": # For refresh token, we need refresh token, client ID and secret refresh_token = arguments.get("zoom_refresh_token") client_id = arguments.get("zoom_client_id") client_secret = arguments.get("zoom_client_secret") access_token = arguments.get("zoom_access_token") # Optional for refresh logger.debug(f"Refresh token parameters: refresh_token={refresh_token[:10] if refresh_token else None}..., client_id={client_id[:5] if client_id else None}...") if not refresh_token: raise ValueError("zoom_refresh_token is required for token refresh") if not client_id or not client_secret: raise ValueError("Both zoom_client_id and zoom_client_secret are required for token refresh") # Initialize Zoom client for token refresh logger.debug("Initializing ZoomClient for token refresh") zoom = ZoomClient( access_token=access_token, refresh_token=refresh_token ) # Call the refresh_access_token method with proper error handling try: logger.debug("Calling zoom.refresh_access_token") results = zoom.refresh_access_token(client_id=client_id, client_secret=client_secret) logger.debug(f"Results from refresh_access_token: {results[:100]}...") return [types.TextContent(type="text", text=results)] except Exception as e: logger.error(f"Exception in refresh_access_token: {str(e)}", exc_info=True) # Print the actual error to help debug return [types.TextContent(type="text", text=json.dumps({ "error": str(e), "status": "error" }))]

Other Tools

Related Tools

Latest Blog Posts

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/peakmojo/mcp-server-zoom-noauth'

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