This guide walks you through setting up OAuth2 authentication with Exact Online.
- An Exact Online account
- An Exact Online App registered at Exact Online App Center
- Your App credentials:
- Client ID
- Client Secret
- Redirect URI (must match your app settings)
- Go to Exact Online App Center
- Create a new app
- Note your Client ID and Client Secret
- Set your Redirect URI (e.g.,
http://localhost:8080/callback)
export EXACT_ONLINE_CLIENT_ID=your-client-id
export EXACT_ONLINE_CLIENT_SECRET=your-client-secret
export EXACT_ONLINE_DIVISION_ID=your-division-id
export EXACT_ONLINE_REDIRECT_URI=http://localhost:8080/callback# .env
EXACT_ONLINE_CLIENT_ID=your-client-id
EXACT_ONLINE_CLIENT_SECRET=your-client-secret
EXACT_ONLINE_DIVISION_ID=your-division-id
EXACT_ONLINE_REDIRECT_URI=http://localhost:8080/callback- Log into Exact Online
- Check your URL:
https://start.exactonline.nl/[DIVISION_ID]/ - Copy the Division ID
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://start.exactonline.nl/api/v1/current/Me?\$select=CurrentDivision"docker-compose up -dOr run directly:
mvn spring-boot:run- Construct the authorization URL:
https://start.exactonline.nl/api/oauth2/auth?
client_id=YOUR_CLIENT_ID&
redirect_uri=YOUR_REDIRECT_URI&
response_type=code&
force_login=0
- Open in browser and authorize
- You'll be redirected to your callback URL with a
codeparameter
- Visit:
http://localhost:8080/callback?code=YOUR_AUTHORIZATION_CODE - The application will exchange the code for tokens automatically
- Tokens are stored in the database
Check the logs to confirm:
INFO - Token exchange successful
INFO - Token stored in database
Or check the database:
SELECT * FROM exact_online_token ORDER BY created_at DESC LIMIT 1;The application automatically refreshes tokens when they expire. No additional configuration needed!
- Verify your Client ID and Client Secret
- Ensure they match your Exact Online App settings
- Check that your redirect URI exactly matches the one in your app settings
- Ensure URL encoding is correct
- Verify your Division ID is correct
- Ensure you have access to the division
Once authenticated, you can:
- Fetch accounts:
GET /api/v1/internal/exact-online/accounts - Fetch subscriptions:
GET /api/v1/internal/exact-online/subscriptions - Set up webhooks:
POST /api/v1/webhook/subscribe