(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.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$response = $sdk->oauthApplications->list(
limit: 10,
offset: 0
);
if ($response->oAuthApplications !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
limit |
?int | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset . |
offset |
?int | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit . |
?Operations\ListOAuthApplicationsResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors93 | 400, 403, 422 | application/json |
Errors\SDKException | 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...
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
use Clerk\Backend\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$request = new Operations\CreateOAuthApplicationRequestBody(
name: '<value>',
callbackUrl: 'https://probable-heating.com/',
scopes: 'profile email public_metadata',
);
$response = $sdk->oauthApplications->create(
request: $request
);
if ($response->oAuthApplicationWithSecret !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreateOAuthApplicationRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors94 | 400, 403, 422 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Fetches the OAuth application whose ID matches the provided id
in the path.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$response = $sdk->oauthApplications->get(
oauthApplicationId: '<id>'
);
if ($response->oAuthApplication !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
oauthApplicationId |
string | ✔️ | The ID of the OAuth application |
?Operations\GetOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors95 | 403, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Updates an existing OAuth application
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
use Clerk\Backend\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$requestBody = new Operations\UpdateOAuthApplicationRequestBody(
scopes: 'profile email public_metadata private_metadata',
);
$response = $sdk->oauthApplications->update(
oauthApplicationId: '<id>',
requestBody: $requestBody
);
if ($response->oAuthApplication !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
oauthApplicationId |
string | ✔️ | The ID of the OAuth application to update |
requestBody |
Operations\UpdateOAuthApplicationRequestBody | ✔️ | N/A |
?Operations\UpdateOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors96 | 403, 404, 422 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Deletes the given OAuth application. This is not reversible.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$response = $sdk->oauthApplications->delete(
oauthApplicationId: '<id>'
);
if ($response->deletedObject !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
oauthApplicationId |
string | ✔️ | The ID of the OAuth application to delete |
?Operations\DeleteOAuthApplicationResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors97 | 403, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Rotates the OAuth application's client secret. When the client secret is rotated, make sure to update it in authorized OAuth clients.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();
$response = $sdk->oauthApplications->rotateSecret(
oauthApplicationId: '<id>'
);
if ($response->oAuthApplicationWithSecret !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
oauthApplicationId |
string | ✔️ | The ID of the OAuth application for which to rotate the client secret |
?Operations\RotateOAuthApplicationSecretResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors98 | 403, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |