auth_revoke
Revoke current authentication and clear tokens to securely end a FreshBooks session and protect account access.
Instructions
Revoke current authentication and clear tokens
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:261-279 (handler)MCP tool handler for 'auth_revoke'. Delegates to OAuth.revokeToken() and returns formatted success response.private async handleAuthRevoke() { await this.oauth.revokeToken(); return { content: [ { type: 'text', text: JSON.stringify( { success: true, message: 'Authentication revoked successfully', }, null, 2 ), }, ], }; }
- src/server.ts:112-119 (registration)Registers 'auth_revoke' tool in the MCP listTools handler with name, description, and empty input schema.{ name: 'auth_revoke', description: 'Revoke current authentication and clear tokens', inputSchema: { type: 'object', properties: {}, }, },
- src/auth/oauth.ts:249-272 (helper)Core revocation logic: POSTs to FreshBooks revoke endpoint using current access token (best-effort), then clears local token storage.async revokeToken(): Promise<void> { const token = await this.tokenStore.get(); if (token?.accessToken) { try { // Attempt to revoke token with FreshBooks await fetch(FreshBooksOAuth.REVOKE_URL, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token.accessToken}`, }, body: JSON.stringify({ token: token.accessToken, }), }); } catch { // Best effort - continue to clear local storage even if revocation fails } } // Clear local token storage await this.tokenStore.clear(); }