gitlabEdit

๐ŸŽซUse Basic Auth with Dispatcher

Learn how to use HTTP Basic Authentication to make Dispatcher API requests.

Overview

Once you've created your Basic Auth header (see Authentication), include it in every Dispatcher API request.

Authentication Flow:

1. Create Basic Auth header: Authorization: Basic <base64(email:password)>
2. Include header in all Dispatcher API requests
3. No token expiration or refresh needed

Basic Usage

Authorization Header

Every Dispatcher API request requires the Authorization header:

Authorization: Basic <base64_encoded_credentials>

Full request example:

POST /api/invoicing HTTP/1.1
Host: api.docs-dispatcher.io
Authorization: Basic b2xpdmllci5yb2VsYW50c0BnbWFpbC5jb206eW91ci1wYXNzd29yZA==
Content-Type: application/json

{
  "providerName": "qonto",
  "documentType": "INVOICE",
  "template": {
    "id": 123,
    "data": { /* template data */ }
  }
}

Code Examples

curl

Node.js (fetch)

PHP (Guzzle)

Java (HttpClient)

Authentication Errors

401 Unauthorized

Error Response:

Common Causes:

  1. Wrong Credentials

    Solution: Verify email and password are correct

  2. Missing Authorization Header

  3. Malformed Header

  4. Encoding Issues

403 Forbidden

Error Response:

Common Causes:

  1. User Lacks Permissions

    • User role doesn't allow this service

    • Solution: Contact admin to grant permissions

  2. Company Configuration Missing

    • Provider not configured for your company

    • Solution: Set up provider config in admin panel

  3. IP Whitelist Restriction

    • Request from non-whitelisted IP

    • Solution: Contact support to update IP whitelist

Reusable Client Class

Node.js

PHP

Best Practices

1. Credential Management

Reuse credentials efficiently:

2. Error Handling

Always handle authentication errors:

3. Secure Storage

Never hardcode credentials:

4. Never Log Credentials

Debugging Authentication

Test Your Credentials

Verify Base64 Encoding

Check Header Format

Security Considerations

1. HTTPS Only

2. Browser Security

3. Credential Rotation

  • Change passwords every 90 days

  • Use strong, unique passwords (min 12 characters)

  • Never share credentials across environments

  • Revoke access immediately when no longer needed

Next Steps

Now that you understand Basic Authentication:

  1. Quickstart Guide - Send your first invoice

  2. Core Concepts - Understand provider configuration

  3. Invoice Recipe - Full dispatch example with code

Support

Last updated