(oAuthApplications())
- list - Get a list of OAuth applications for an instance
- create - Create an OAuth application
- get - Retrieve an OAuth application by ID
- updateApplication - Update an OAuth application
- delete - Delete an OAuth application
- rotateSecret - Rotate the client secret of the given OAuth application
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.
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("<YOUR_BEARER_TOKEN_HERE>")
.build();
ListOAuthApplicationsResponse res = sdk.oAuthApplications().list()
.limit(10L)
.offset(0L)
.call();
while (true) {
if (res.oAuthApplications().isPresent()) {
// handle response
Optional<ListOAuthApplicationsResponse> 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;
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
Optional<? extends Long> | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
offset |
Optional<? extends Long> | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
Optional<? extends com.clerk.backend_api.models.operations.ListOAuthApplicationsResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 400,403,422 | application/json |
| models/errors/SDKError | 4xx-5xx | / |
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...
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("<YOUR_BEARER_TOKEN_HERE>")
.build();
CreateOAuthApplicationRequestBody req = CreateOAuthApplicationRequestBody.builder()
.name("<value>")
.callbackUrl("<value>")
.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;
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
com.clerk.backend_api.models.operations.CreateOAuthApplicationRequestBody | ✔️ | The request object to use for the request. |
Optional<? extends com.clerk.backend_api.models.operations.CreateOAuthApplicationResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 400,403,422 | application/json |
| models/errors/SDKError | 4xx-5xx | / |
Fetches the OAuth application whose ID matches the provided id in the path.
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("<YOUR_BEARER_TOKEN_HERE>")
.build();
GetOAuthApplicationResponse res = sdk.oAuthApplications().get()
.oauthApplicationId("<value>")
.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;
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
oauthApplicationId |
String | ✔️ | The ID of the OAuth application |
Optional<? extends com.clerk.backend_api.models.operations.GetOAuthApplicationResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 403,404 | application/json |
| models/errors/SDKError | 4xx-5xx | / |
Updates an existing OAuth application
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("<YOUR_BEARER_TOKEN_HERE>")
.build();
UpdateOAuthApplicationResponse res = sdk.oAuthApplications().updateApplication()
.oauthApplicationId("<value>")
.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;
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
oauthApplicationId |
String | ✔️ | The ID of the OAuth application to update |
requestBody |
com.clerk.backend_api.models.operations.UpdateOAuthApplicationRequestBody | ✔️ | N/A |
Optional<? extends com.clerk.backend_api.models.operations.UpdateOAuthApplicationResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 403,404,422 | application/json |
| models/errors/SDKError | 4xx-5xx | / |
Deletes the given OAuth application. This is not reversible.
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("<YOUR_BEARER_TOKEN_HERE>")
.build();
DeleteOAuthApplicationResponse res = sdk.oAuthApplications().delete()
.oauthApplicationId("<value>")
.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;
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
oauthApplicationId |
String | ✔️ | The ID of the OAuth application to delete |
Optional<? extends com.clerk.backend_api.models.operations.DeleteOAuthApplicationResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 403,404 | application/json |
| models/errors/SDKError | 4xx-5xx | / |
Rotates the OAuth application's client secret. When the client secret is rotated, make sure to update it in authorized OAuth clients.
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("<YOUR_BEARER_TOKEN_HERE>")
.build();
RotateOAuthApplicationSecretResponse res = sdk.oAuthApplications().rotateSecret()
.oauthApplicationId("<value>")
.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;
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
oauthApplicationId |
String | ✔️ | The ID of the OAuth application for which to rotate the client secret |
Optional<? extends com.clerk.backend_api.models.operations.RotateOAuthApplicationSecretResponse>
| Error Object | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 403,404 | application/json |
| models/errors/SDKError | 4xx-5xx | / |