This guide covers the authentication methods available for integrating with the E-Invoicing API. There are two main authentication methods, each with different requirements and use cases.
Direct Authentication uses the OAuth 2.0 Client Credentials flow, which is suitable for server-to-server communication where your application acts on its own behalf.Use Case: When your application directly manages your own invoices.Authentication Method: OAuth 2.0 Client Credentials Flow
On Behalf Authentication uses a combination of Client Credentials (for Resource APIs) and Authorization Code flow (for Invoice APIs). This allows your application to act on behalf of multiple businesses with their explicit consent.Use Case: When your application manages invoices on behalf of multiple tax payers.Authentication Method:
Step 1: Redirect User for Authorization (Invoice APIs)
Sample Authorization URL
Copy
const authUrl = new URL('${AUTH_BASE_URL}/oauth2/authorize');authUrl.searchParams.set('response_type', 'code');authUrl.searchParams.set('client_id', 'YOUR_CLIENT_ID');authUrl.searchParams.set('redirect_uri', 'https://your-app.com/callback');authUrl.searchParams.set('scope', 'invoices');authUrl.searchParams.set('state', 'random-state-string');// Redirect user to this URLwindow.location.href = authUrl.toString();