(OauthApplications)
- List - Get a list of OAuth applications for an instance
- Create - Create an OAuth application
- Get - Retrieve an OAuth application by ID
- Update - 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.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.OauthApplications.ListAsync(
limit: 20,
offset: 10
);
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Limit |
long | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset . |
20 |
Offset |
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 . |
10 |
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 403, 422 | application/json |
Clerk.BackendAPI.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...
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
CreateOAuthApplicationRequestBody req = new CreateOAuthApplicationRequestBody() {
Name = "Example App",
CallbackUrl = "https://example.com/oauth/callback",
Scopes = "profile email public_metadata",
Public = true,
};
var res = await sdk.OauthApplications.CreateAsync(req);
// handle response
Parameter | Type | Required | Description |
---|---|---|---|
request |
CreateOAuthApplicationRequestBody | ✔️ | The request object to use for the request. |
CreateOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 403, 422 | application/json |
Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Fetches the OAuth application whose ID matches the provided id
in the path.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.OauthApplications.GetAsync(oauthApplicationId: "oauth_app_12345");
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
OauthApplicationId |
string | ✔️ | The ID of the OAuth application | oauth_app_12345 |
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 403, 404 | application/json |
Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Updates an existing OAuth application
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.OauthApplications.UpdateAsync(
oauthApplicationId: "oauth_app_67890",
requestBody: new UpdateOAuthApplicationRequestBody() {
Name = "Updated OAuth App Name",
CallbackUrl = "https://example.com/oauth/callback",
Scopes = "profile email public_metadata private_metadata",
}
);
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
OauthApplicationId |
string | ✔️ | The ID of the OAuth application to update | oauth_app_67890 |
RequestBody |
UpdateOAuthApplicationRequestBody | ✔️ | N/A |
UpdateOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 403, 404, 422 | application/json |
Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Deletes the given OAuth application. This is not reversible.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.OauthApplications.DeleteAsync(oauthApplicationId: "oauth_app_09876");
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
OauthApplicationId |
string | ✔️ | The ID of the OAuth application to delete | oauth_app_09876 |
DeleteOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 403, 404 | application/json |
Clerk.BackendAPI.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.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.OauthApplications.RotateSecretAsync(oauthApplicationId: "oauth_application_12345");
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
OauthApplicationId |
string | ✔️ | The ID of the OAuth application for which to rotate the client secret | oauth_application_12345 |
RotateOAuthApplicationSecretResponse
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 403, 404 | application/json |
Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |