Authentication
Use the OAuth2 client credentials supplied by your Device Park administrator. Create the client once before calling other SDK methods and reuse it during the test run.
Before You Begin
Set the credentials as environment variables:
export DEVICEPARK_CLIENT_ID=your-client-id
export DEVICEPARK_CLIENT_SECRET=your-client-secretKeep clientSecret outside source control, CI output and application logs. Load credentials from your secret manager or environment.
The SDK base URL is https://devicepark.testinium.io in the examples below. Credentials are the only secret values; the URL is not read from an environment variable by SDK version 1.0.1.
Create the Client
Create one client for the test run and close it during cleanup. Choose your SDK language:
import io.testinium.devicepark.DeviceParkApiClient;
import io.testinium.devicepark.authentication.credentials.Credentials;
try (DeviceParkApiClient client = DeviceParkApiClient.builder()
.url("https://devicepark.testinium.io")
.credentials(Credentials.of(
System.getenv("DEVICEPARK_CLIENT_ID"),
System.getenv("DEVICEPARK_CLIENT_SECRET")))
.timeout(30)
.build()) {
// Call SDK methods with this client.
}Java uses Credentials.of(...). Node.js Credentials.fromEnvironment() reads DEVICEPARK_CLIENT_ID and DEVICEPARK_CLIENT_SECRET.
In Node.js, credentials already available in application configuration can be passed with Credentials.create(clientId, clientSecret) or .credentialsFrom(clientId, clientSecret).
Configuration
Value | Required | Java | Node.js |
|---|---|---|---|
url | Yes | .url(...) | .url(...) |
clientId | Yes | Credentials.of(...) | Environment or Credentials.create(...) |
clientSecret | Yes | Credentials.of(...) | Environment or Credentials.create(...) |
timeout | No | Seconds; default 60 | Seconds; default 60 |
Token Management
The client requests a token on the first SDK operation, keeps it in memory and renews it before expiration. Token renewal uses a 60-second safety margin. Application code does not need a token-refresh task.
Create one client per test run. Creating a client for every method call discards the cached token.