Client Credentials
The Client Credentials grant type is used by clients to obtain an access token outside of the context of a user. The client application is assumed to be the resource owner and the access request is to the application’s resources.
How It Works
Section titled “How It Works”The following diagram describes the Client Credential flow:
What You Need
Section titled “What You Need”You will need the following information from Trimble:
- Client ID
- Client secret
Request
Section titled “Request”POST /oauth/tokenHeader
Section titled “Header”| Header | Description |
|---|---|
| Authorization | Basic credentials |
| Content-Type | application/x-www-form-urlencoded |
Body is x-www-form-urlencoded with the following fields:
| Field | Description |
|---|---|
| grant_type | client_credentials |
| scope | Include only the scope(s) needed to enable intended functionality as documented for each API product to which access is being granted. |
Examples
Section titled “Examples”The following are examples of token requests using the Client Credentials grant type.
POST /oauth/token HTTP/1.1Host: id.trimble.comContent-Type: application/x-www-form-urlencodedAuthorization: Basic {credentials}Content-Length: 89
grant_type=client_credentials&scope={scope}# Application credentialsclient_id="client ID"client_secret="client secret"
encoded_credentials=$(echo -n "$client_id:$client_secret" | base64)
curl --location "https://id.trimble.com/oauth/token" \--header "Content-Type: application/x-www-form-urlencoded" \--header "Authorization: Basic $encoded_credentials" \--data-urlencode "grant_type=client_credentials" \--data-urlencode "scope=$scope"Response
Section titled “Response”{ "token_type": "bearer", "expires_in": 3600, "access_token": "eyJhbGciOiJ...LaHpfIpRAzHakV2ossbnpA"}