freshbooks_authenticate_with_code
Complete FreshBooks authentication by entering an authorization code manually when callback servers are unavailable. Paste the code from the redirect URL to establish secure API access.
Instructions
Complete authentication with an authorization code (if callback server isn't used). Paste the code from the redirect URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Implementation Reference
- src/mcp_freshbooks/server.py:97-105 (handler)The implementation of the 'freshbooks_authenticate_with_code' tool, which handles the exchange of an authorization code for access tokens and verifies the authentication status.
@mcp.tool() def freshbooks_authenticate_with_code(code: str) -> str: """Complete authentication with an authorization code (if callback server isn't used). Paste the code from the redirect URL.""" config = auth.get_config() tokens = auth.exchange_code(config, code) if tokens: identity = auth.get_identity(tokens["access_token"]) return f"Authenticated as {identity['first_name']} {identity['last_name']} ({identity['email']})\nBusiness: {identity['business_name']}\nAccount ID: {identity['account_id']}" return "Authentication failed."