# OAuthApplications (*oAuthApplications()*) ### Available Operations * [list](#list) - Get a list of OAuth applications for an instance * [create](#create) - Create an OAuth application * [get](#get) - Retrieve an OAuth application by ID * [updateApplication](#updateapplication) - Update an OAuth application * [delete](#delete) - Delete an OAuth application * [rotateSecret](#rotatesecret) - Rotate the client secret of the given OAuth application ## list This request returns the list of OAuth applications for an instance. Results can be paginated using the optional `limit` and `offset` query parameters. The OAuth applications are ordered by descending creation date. Most recent OAuth applications will be returned first. ### Example Usage ```java package hello.world; import com.clerk.backend_api.Clerk; import com.clerk.backend_api.models.components.*; import com.clerk.backend_api.models.components.Security; import com.clerk.backend_api.models.operations.*; import com.clerk.backend_api.utils.EventStream; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { Clerk sdk = Clerk.builder() .bearerAuth("") .build(); ListOAuthApplicationsResponse res = sdk.oAuthApplications().list() .limit(10L) .offset(0L) .call(); while (true) { if (res.oAuthApplications().isPresent()) { // handle response Optional nextRes = res.next(); if (nextRes.isPresent()) { res = nextRes.get(); } else { break; } } } } catch (com.clerk.backend_api.models.errors.ClerkErrors e) { // handle exception throw e; } catch (com.clerk.backend_api.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `limit` | *Optional* | :heavy_minus_sign: | Applies a limit to the number of results returned.
Can be used for paginating the results together with `offset`. | | `offset` | *Optional* | :heavy_minus_sign: | Skip the first `offset` results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with `limit`. | ### Response **[Optional](../../models/operations/ListOAuthApplicationsResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models/errors/ClerkErrors | 400,403,422 | application/json | | models/errors/SDKError | 4xx-5xx | */* | ## create Creates a new OAuth application with the given name and callback URL for an instance. The callback URL must be a valid url. All URL schemes are allowed such as `http://`, `https://`, `myapp://`, etc... ### Example Usage ```java package hello.world; import com.clerk.backend_api.Clerk; import com.clerk.backend_api.models.components.*; import com.clerk.backend_api.models.components.Security; import com.clerk.backend_api.models.operations.*; import com.clerk.backend_api.utils.EventStream; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { Clerk sdk = Clerk.builder() .bearerAuth("") .build(); CreateOAuthApplicationRequestBody req = CreateOAuthApplicationRequestBody.builder() .name("") .callbackUrl("") .scopes("profile email public_metadata") .build(); CreateOAuthApplicationResponse res = sdk.oAuthApplications().create() .request(req) .call(); if (res.oAuthApplicationWithSecret().isPresent()) { // handle response } } catch (com.clerk.backend_api.models.errors.ClerkErrors e) { // handle exception throw e; } catch (com.clerk.backend_api.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `request` | [com.clerk.backend_api.models.operations.CreateOAuthApplicationRequestBody](../../models/operations/CreateOAuthApplicationRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | ### Response **[Optional](../../models/operations/CreateOAuthApplicationResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models/errors/ClerkErrors | 400,403,422 | application/json | | models/errors/SDKError | 4xx-5xx | */* | ## get Fetches the OAuth application whose ID matches the provided `id` in the path. ### Example Usage ```java package hello.world; import com.clerk.backend_api.Clerk; import com.clerk.backend_api.models.components.*; import com.clerk.backend_api.models.components.Security; import com.clerk.backend_api.models.operations.*; import com.clerk.backend_api.utils.EventStream; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { Clerk sdk = Clerk.builder() .bearerAuth("") .build(); GetOAuthApplicationResponse res = sdk.oAuthApplications().get() .oauthApplicationId("") .call(); if (res.oAuthApplication().isPresent()) { // handle response } } catch (com.clerk.backend_api.models.errors.ClerkErrors e) { // handle exception throw e; } catch (com.clerk.backend_api.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | | `oauthApplicationId` | *String* | :heavy_check_mark: | The ID of the OAuth application | ### Response **[Optional](../../models/operations/GetOAuthApplicationResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models/errors/ClerkErrors | 403,404 | application/json | | models/errors/SDKError | 4xx-5xx | */* | ## updateApplication Updates an existing OAuth application ### Example Usage ```java package hello.world; import com.clerk.backend_api.Clerk; import com.clerk.backend_api.models.components.*; import com.clerk.backend_api.models.components.Security; import com.clerk.backend_api.models.operations.*; import com.clerk.backend_api.utils.EventStream; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { Clerk sdk = Clerk.builder() .bearerAuth("") .build(); UpdateOAuthApplicationResponse res = sdk.oAuthApplications().updateApplication() .oauthApplicationId("") .requestBody(UpdateOAuthApplicationRequestBody.builder() .scopes("profile email public_metadata private_metadata") .build()) .call(); if (res.oAuthApplication().isPresent()) { // handle response } } catch (com.clerk.backend_api.models.errors.ClerkErrors e) { // handle exception throw e; } catch (com.clerk.backend_api.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `oauthApplicationId` | *String* | :heavy_check_mark: | The ID of the OAuth application to update | | `requestBody` | [com.clerk.backend_api.models.operations.UpdateOAuthApplicationRequestBody](../../models/operations/UpdateOAuthApplicationRequestBody.md) | :heavy_check_mark: | N/A | ### Response **[Optional](../../models/operations/UpdateOAuthApplicationResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models/errors/ClerkErrors | 403,404,422 | application/json | | models/errors/SDKError | 4xx-5xx | */* | ## delete Deletes the given OAuth application. This is not reversible. ### Example Usage ```java package hello.world; import com.clerk.backend_api.Clerk; import com.clerk.backend_api.models.components.*; import com.clerk.backend_api.models.components.Security; import com.clerk.backend_api.models.operations.*; import com.clerk.backend_api.utils.EventStream; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { Clerk sdk = Clerk.builder() .bearerAuth("") .build(); DeleteOAuthApplicationResponse res = sdk.oAuthApplications().delete() .oauthApplicationId("") .call(); if (res.deletedObject().isPresent()) { // handle response } } catch (com.clerk.backend_api.models.errors.ClerkErrors e) { // handle exception throw e; } catch (com.clerk.backend_api.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | | `oauthApplicationId` | *String* | :heavy_check_mark: | The ID of the OAuth application to delete | ### Response **[Optional](../../models/operations/DeleteOAuthApplicationResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models/errors/ClerkErrors | 403,404 | application/json | | models/errors/SDKError | 4xx-5xx | */* | ## rotateSecret Rotates the OAuth application's client secret. When the client secret is rotated, make sure to update it in authorized OAuth clients. ### Example Usage ```java package hello.world; import com.clerk.backend_api.Clerk; import com.clerk.backend_api.models.components.*; import com.clerk.backend_api.models.components.Security; import com.clerk.backend_api.models.operations.*; import com.clerk.backend_api.utils.EventStream; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { Clerk sdk = Clerk.builder() .bearerAuth("") .build(); RotateOAuthApplicationSecretResponse res = sdk.oAuthApplications().rotateSecret() .oauthApplicationId("") .call(); if (res.oAuthApplicationWithSecret().isPresent()) { // handle response } } catch (com.clerk.backend_api.models.errors.ClerkErrors e) { // handle exception throw e; } catch (com.clerk.backend_api.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | | `oauthApplicationId` | *String* | :heavy_check_mark: | The ID of the OAuth application for which to rotate the client secret | ### Response **[Optional](../../models/operations/RotateOAuthApplicationSecretResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models/errors/ClerkErrors | 403,404 | application/json | | models/errors/SDKError | 4xx-5xx | */* |