The Trinsic API Java library provides convenient access to the Trinsic API from applications written in Java.
Trinsic API Java Library
The Trinsic API Java library provides convenient access to the Trinsic API from
applications written in Java.
Documentation
See the Trinsic docs for more detailed information on how to start integrating with our identity acceptance network.
Installation
Maven
Add the following to your pom.xml file:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.trinsic-id</groupId>
<artifactId>sdk-java-api</artifactId>
<version>Tag</version>
</dependency>
</dependencies>Gradle
Add the following to your build.gradle or build.gradle.kts file:
build.gradle (Groovy)
build.gradle (Groovy)dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.trinsic-id:sdk-java-api:Tag'
}build.gradle.kts (Kotlin)
build.gradle.kts (Kotlin)dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
}
dependencies {
implementation("com.github.trinsic-id:sdk-java-api:Tag")
}Usage
The package needs to be configured with your app's access token, which is available in the Trinsic Dashboard.
var apiClient = new ApiClient();
apiClient.setRequestInterceptor(interceptor -> {
interceptor.setHeader("Authorization", "Bearer " + "your-access-token");
});
var attachments = new AttachmentsApi(apiClient);
var network = new NetworkApi(apiClient);
var sessions = new SessionsApi(apiClient);You can find a full Java example in the samples folder.
Construct request models using no-argument constructors and named setters or
fluent methods:
var request = new CreateHostedProviderSessionRequest()
.provider("provider-id")
.verificationProfileId(verificationProfileId)
.redirectUrl("https://example.com/return")
.enableRedirectBackwardsCompatibility(false);Read-only model field constructors are private and reserved for Jackson
deserialization. Public positional field construction is no longer supported.
This is a breaking change intended for the next major SDK release; endpoint and
client constructor signatures retain their existing calling conventions.
Data residency
By default, the SDK communicates with https://api.trinsic.id. If you have a Verification Profile configured for EU data residency, point the SDK at the EU endpoint by calling updateBaseUri on the ApiClient:
var apiClient = new ApiClient();
apiClient.updateBaseUri("https://api.eu.trinsic.id"); // omit to use the default endpoint
apiClient.setRequestInterceptor(interceptor -> {
interceptor.setHeader("Authorization", "Bearer " + "your-access-token");
});
var sessions = new SessionsApi(apiClient);Unknown enum values
The API can add enum values after this SDK version was released. A value this
version does not know is read as the enum's UNKNOWN_DEFAULT_OPEN_API member
instead of failing the response:
if (session.getErrorCode() == SessionErrorCode.UNKNOWN_DEFAULT_OPEN_API) {
// An error code newer than this SDK version.
}Upgrade the SDK to read the new value. Do not send the fallback member in
requests; the API does not accept it.
SDK Versioning
Our SDKs follow the Semantic Versioning ("SemVer") scheme.
For example, the version number 1.13.0 has a major version of 1, a minor version of 13, and a patch version of 0.
Breaking changes are only introduced alongside a new major version.
Support
Any issues, inquiries, and feature requests can be sent to [email protected], or feel free to open a GitHub issue here.
