Skip to content

Latest commit

 

History

History
249 lines (167 loc) · 15.7 KB

File metadata and controls

249 lines (167 loc) · 15.7 KB

OauthApplications

(OauthApplications)

Overview

Available Operations

  • 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

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

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

Parameters

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

Response

ListOAuthApplicationsResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 403, 422 application/json
Clerk.BackendAPI.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

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

Parameters

Parameter Type Required Description
request CreateOAuthApplicationRequestBody ✔️ The request object to use for the request.

Response

CreateOAuthApplicationResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 403, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Get

Fetches the OAuth application whose ID matches the provided id in the path.

Example Usage

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

Parameters

Parameter Type Required Description Example
OauthApplicationId string ✔️ The ID of the OAuth application oauth_app_12345

Response

GetOAuthApplicationResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 403, 404 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Update

Updates an existing OAuth application

Example Usage

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

Parameters

Parameter Type Required Description Example
OauthApplicationId string ✔️ The ID of the OAuth application to update oauth_app_67890
RequestBody UpdateOAuthApplicationRequestBody ✔️ N/A

Response

UpdateOAuthApplicationResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 403, 404, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Delete

Deletes the given OAuth application. This is not reversible.

Example Usage

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

Parameters

Parameter Type Required Description Example
OauthApplicationId string ✔️ The ID of the OAuth application to delete oauth_app_09876

Response

DeleteOAuthApplicationResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 403, 404 application/json
Clerk.BackendAPI.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

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

Parameters

Parameter Type Required Description Example
OauthApplicationId string ✔️ The ID of the OAuth application for which to rotate the client secret oauth_application_12345

Response

RotateOAuthApplicationSecretResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 403, 404 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*