# Java SDK

Java 17 or later, standard library only.

## Install

```xml
<dependency>
  <groupId>com.ohauthcat</groupId>
  <artifactId>ohauthcat</artifactId>
  <version>0.0.2</version>
</dependency>
```

- Create a client: `OhAuthCatClient.builder(System.getenv("OHAUTHCAT_API_KEY")).clientId("pk_...").build()`.
- Call any API operation, for example `client.organizations.getOrganization("org_...")`. List calls have auto-paging variants such as `listDirectoryUsersAutoPaging`.
- SSO: `client.ssoHelpers.getAuthorizationUrl(options)` returns the URL and the PKCE `codeVerifier()` to keep; after the redirect, `client.ssoHelpers.getProfileAndToken(code, codeVerifier, redirectUri)`.
- Webhooks: `Webhooks.verify(rawBody, signatureHeader, secret)` checks the `OhAuthCat-Signature` of the raw bytes before you parse them.
- Errors are `OhAuthCatException` subclasses by type, such as `NotFound` and `RateLimited`, with the stable `code()`.
- Set your own idempotency key with `RequestOptions.create().idempotencyKey(...)`.
