trimble-id
Trimble Identity SDK for Python
Installation
Section titled “Installation”You can install with pip:
pip install trimble-idConfigure Trimble Identity
Section titled “Configure Trimble Identity”Create a new application in the Trimble Developer Console portal and configure the following settings:
To register your application in Trimble Developer Console:
-
On the left pane select “Applications”.
-
On the Applications home page, in the top right corner select + NEW APPLICATION. The Create Application page displays.
-
Select Continue to enter the applications details.
Field Description Name Name of your application Description Provide a description for the application. -
Configure OAuth application grant types
Client Credentialsin order to use this SDK. -
Select “Create Application” to save changes.
Take note of the Client ID and URLs under the “Basic Information” section. You’ll need these values to configure the SDK.
Scopes
Trimble Identity uses scopes to determine the aud claim in the returned access token. Scope is mandatory for the application to work. You can use the scope as the application name registered in the Trimble Developer Console. For example, if you have registered an application with the name “test”, then it must be registered in the format {some_uuid}-“test”. For eg., 12345678-1234-1234-1234-123456789012-test.
For more information, see Authentication documentation.
Well-Known URL endpoint
Section titled “Well-Known URL endpoint”The well-known URL endpoint is used to retrieve the authorization, token and user info endpoints for a given environment. The following endpoints are available for the staging and production environments:
| Stage Well-Known URL | https://stage.id.trimblecloud.com/.well-known/openid-configuration |
|---|---|
| Production Well-Known URL | https://id.trimble.com/.well-known/openid-configuration |
OpenID Endpoint Provider
Section titled “OpenID Endpoint Provider”This endpoint provider is used to retrieve the endpoints from a well-known URL endpoint.
from trimble.id import OpenIdEndpointProvider
endpoint_provider = OpenIdEndpointProvider("https://id.trimble.com/.well-known/openid-configuration")auth_endpoint = await endpoint_provider.retrieve_authorization_endpoint()token_endpoint = await endpoint_provider.retrieve_token_endpoint()Fixed Endpoint Provider
Section titled “Fixed Endpoint Provider”This endpoint provider is used to provide a fixed set of endpoints.
from trimble.id import FixedEndpointProvider
endpoint_provider = FixedEndpointProvider("https://authorization.url", "https://token.url", "https://userinfo.url")endpoint = await endpoint_provider.retrieve_authorization_endpoint()Client Credential Token Provider
Section titled “Client Credential Token Provider”This token provider is used to retrieve an access token using the client credentials grant type.
from trimble.id import ClientCredentialTokenProvider
token_provider = ClientCredentialTokenProvider(endpoint_provider, "client_id", "client_secret").with_scopes(["scope"])
access_token = await token_provider.retrieve_token()Validate Claimset Provider
Section titled “Validate Claimset Provider”Provides the validated claimset for a JSON web token.
from trimble.id import ValidatedClaimsetProvider, OpenIdKeySetProvider
keyset_provider = OpenIdKeySetProvider(endpoint_provider)
claimsetProvider = ValidatedClaimsetProvider(keyset_provider)
claimset = await claimsetProvider.retrieve_claimset(access_token)NOTE: Refer samples for better understanding.
Samples
Section titled “Samples”See here for samples
Send email to cloudplatform_support@trimble.com