Troubleshooting OAuth2 Authentication Errors
Last updated: July 4, 2025
When using Formance APIs, you may encounter OAuth2-related authentication errors. Here's how to resolve common issues:
Invalid Request: grant_type missing
If you receive an error like:
{
error: 'invalid_request',
error_description: 'grant_type missing'
}
This means you need to specify the grant type in your authentication request. Make sure to include the grant_type parameter in your request.
502 Bad Gateway Error
If you encounter a "502 Bad Gateway" error when fetching OAuth2 tokens, this typically indicates a temporary connectivity issue with the authentication service. Common causes include:
The auth service pod is restarting
Node scheduling issues in your Kubernetes cluster
Temporary network connectivity problems
To troubleshoot:
Verify the auth service is running:
kubectl get pods -n your-namespace | grep authCheck if the auth pod is in "Running" state with normal restart counts
If using cloud providers like GCP, consider using non-preemptible nodes to avoid scheduling interruptions
Additional Resources
For detailed authentication examples and documentation, refer to our Machine-to-Machine Authentication Guide.