How to connect to Driftrock OAuth2 API
How to connect to Driftrock OAuth2 API
Our API supports the OAuth 2.0 Client Credentials Grant as specified in RFC 6749 Section 4.4 for requesting JWT Access Tokens to be used in calling our API.
The endpoints used to exchange client credentials for access tokens are as follow:
- Staging Environment:
https://api-staging.driftrock.com/oauth2/token - Production Environment:
https://external-apis.driftrock.com/oauth2/token
When implementing, please keep in mind:
- Use
Authorization: Basic <encoded credentials>scheme to authenticate with client credentials and thegrant_type=client_credentialsparameter, when requesting an access token - Use
Authorization: Bearer <access_token>when making calls to our API.
Examples
Access Token Request
Response Successful
Response Error
Using the JWT Access Token with our API
Once you obtain the JWT Access Token, you can use it to authenticate API requests to any /v2 endpoint:
Security Considerations
- Always transmit client credentials and tokens over HTTPS
- Store client secrets securely and never expose them publicly, such as in front-end implementation or mobile applications.
Best Practices
- Use OAuth 2.0 Client Credentials for all new integrations
- Consider migrating existing integrations from API keys to OAuth 2.0
- Implement proper token expiration and requesting new tokens.
Basic Authorization Scheme
As described by RFC 7617, the Basic scheme requires the following encoding of client credentials:
Authorization: Basic <credential , where <credentials> is the Base64 encoding of client ID and client secret joined by a single colon:
JavaScript example: