Authentication Flows
Client Credentials Grant (Server-to-Server)
For server-to-server integrations without user involvement, use the Client Credentials flow. This is ideal for backend services that need to access BuildPass data programmatically. π This page documents the Client Credentials flow.Authorization Code Grant (User Authorization)
For applications that need user consent and access to data on behalf of specific builders, use the Authorization Code flow with PKCE.OAuth 2.0 Authorization Code Flow
Learn about user authorization with PKCE for integrator applications.
Client Types
BuildPass supports two types of OAuth 2.0 clients, each designed for different security requirements:Confidential Clients
Confidential clients can securely store credentials and are required to authenticate with aclient_secret.
Best for:
- Backend services and servers
- Server-to-server integrations
- Applications running in secure, controlled environments
- Services where credentials can be kept private
client_id and client_secret to obtain access tokens.
Public Clients
Public clients cannot securely store credentials (e.g., mobile apps, single-page applications) and can authenticate without aclient_secret.
Best for:
- Mobile applications (iOS, Android)
- Single-page applications (SPAs)
- Desktop applications
- Browser-based applications
client_id. Must use PKCE (Proof Key for Code Exchange) with the Authorization Code flow for security.
Your client type is determined when BuildPass provisions your integration credentials. Contact BuildPass support if you need to change your client type or are unsure which type you have.
Client Credentials Grant
This flow provides secure, token-based authentication for server-to-server integrations.Step 1: Obtain Client Credentials
You need to have the following client credentials:client_idclient_secret
Step 2: Generate an OAuth Token
To generate an OAuth token, you need to make a POST request to the/oauth/token endpoint with your client credentials. The request body should include the following parameters:
client_id: Your client ID.client_secret: Your client secret.scope: The scopes you want to request access to. Available scopes includeread:builders,read:subcontractors,read:prequalifications,read:insurances,read:contacts,read:swms,read:timesheets,read:inductions.audience: The audience for the token. This should be set tohttps://api.buildpass.global.grant_type: The grant type you want to use. This should be set toclient_credentials.
API reference
Check out the API reference for our OAuth2 token endpoint.
Example Request
Alternative: HTTP Basic Authentication
You can also provide client credentials via HTTP Basic Authentication instead of the request body:Form Data Support
The endpoint also supportsapplication/x-www-form-urlencoded content type:
Response Format
The token response follows OAuth 2.0 standards:Error Responses
Error responses follow OAuth 2.0 RFC 6749 standards:invalid_request: Missing or malformed request parametersinvalid_client: Invalid client credentialsinvalid_scope: Requested scopes are invalid for the audienceunsupported_grant_type: Grant type not supported
Step 3: Use the Access Token
Once you have the access token, include it in the Authorization header of your API requests as a Bearer token.Example Authorization Header
OAuth 2.0 Compliance Features
Our implementation is fully compliant with OAuth 2.0 standards:RFC 6749 - OAuth 2.0 Authorization Framework
- β Client Credentials Grant (Section 4.4)
- β Standard Token Response Format (Section 5.1)
- β Standard Error Response Format (Section 5.2)
- β Client Authentication Methods (Section 2.3.1)
RFC 6750 - Bearer Token Usage
- β Authorization Request Header Field (Section 2.1)
- β Cache Control Headers (Section 3)
Additional Security Features
- β JWT Access Tokens with HMAC-SHA256 signing
- β Unique Token IDs (jti claim) for token tracking
- β Encrypted Client Secret Storage
- β Audience-Specific Scope Validation
- β Comprehensive Audit Logging
Token Management
- Token Lifetime: 1 hour (3600 seconds)
- Token Format: JSON Web Token (JWT)
- Signing Algorithm: HMAC-SHA256
- Security Headers: Cache-Control: no-store, Pragma: no-cache
Token Security Best Practices
Credential Storage
- Encrypt client secrets at rest - Never store in plain text or environment variables visible in logs
- Use secure credential management - Consider using secret managers (AWS Secrets Manager, HashiCorp Vault, etc.)
- Encrypt access tokens at rest - Use your platformβs secure storage
- Never log credentials or tokens - Treat them as sensitive data
- Rotate credentials periodically - Contact BuildPass support for credential rotation
Token Handling
Access Token Storage
For applications that cache access tokens:Network Security
- Always use HTTPS - BuildPass API only accepts HTTPS connections
- Validate TLS certificates - Donβt disable certificate validation
- Use Basic Auth header - Preferred method for client credentials
- Donβt include credentials in URLs - Use headers or request body
Monitoring and Auditing
BuildPass provides comprehensive audit logging:- All token requests are logged with client ID and IP address
- Failed authentication attempts are tracked
- Unusual patterns trigger alerts
- Monitor your token usage patterns
- Set up alerts for failed authentication attempts
- Regularly review access logs
- Investigate unexpected token requests