Skip to content

Commit

Permalink
Update Redirect Url Backend SDK docs to match BAPI docs (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisintech authored Jul 10, 2024
1 parent ac01114 commit 3bd1c7f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
4 changes: 4 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2268,6 +2268,10 @@
"title": "Backend `Client` object",
"href": "/docs/references/backend/types/backend-client"
},
{
"title": "Backend `RedirectURL` object",
"href": "/docs/references/backend/types/backend-redirect-url"
},
{
"title": "Backend User object",
"href": "/docs/references/backend/types/backend-user"
Expand Down
10 changes: 6 additions & 4 deletions docs/references/backend/redirect-urls/create-redirect-url.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ title: createRedirectUrl()
description: Use Clerk's Backend SDK to create a redirect URL.
---

{/* clerk/javascript file: https://github.com/clerk/javascript/blob/main/packages/backend/src/api/endpoints/RedirectUrlApi.ts#L29 */}

# `createRedirectUrl()`

Creates a redirect URL.
Creates a [`RedirectUrl`](/docs/references/backend/types/backend-redirect-url).

```tsx
function createRedirectUrl: (params: createRedirectUrlParams) => Promise<RedirectUrl>;
function createRedirectUrl: (params: CreateRedirectUrlParams) => Promise<RedirectUrl>;
```

## `createRedirectUrlParams`
## `CreateRedirectUrlParams`

| Name | Type | Description |
| --- | --- | --- |
Expand All @@ -27,7 +29,7 @@ const response = await clerkClient.redirectUrls.createRedirectUrl({
console.log(response);
/*
_RedirectUrl {
id: 'ru_2bxLHVfYsA13r8iKHWoY8SAr9az',
id: 'ru_123',
url: 'https://example.com',
createdAt: 1707151695693,
updatedAt: 1707151695693
Expand Down
8 changes: 5 additions & 3 deletions docs/references/backend/redirect-urls/delete-redirect-url.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ title: deleteRedirectUrl()
description: Use Clerk's Backend SDK to delete a redirect URL.
---

{/* clerk/javascript file: https://github.com/clerk/javascript/blob/main/packages/backend/src/api/endpoints/RedirectUrlApi.ts#L37 */}

# `deleteRedirectUrl()`

Deletes a redirect URL, given a valid ID.
Deletes a [`RedirectUrl`](/docs/references/backend/types/backend-redirect-url).

```tsx
function deleteRedirectUrl: (redirectUrlId: string) => Promise<RedirectUrl>;
Expand All @@ -20,15 +22,15 @@ function deleteRedirectUrl: (redirectUrlId: string) => Promise<RedirectUrl>;
## Example

```tsx
const redirectUrlId = 'ru_2bxLHVfYsA13r8iKHWoY8SAr9az';
const redirectUrlId = 'ru_123';

const response = await clerkClient.redirectUrls.deleteRedirectUrl(redirectUrlId);

console.log(response);
/*
_DeletedObject {
object: 'redirect_url',
id: 'ru_2bxLHVfYsA13r8iKHWoY8SAr9az',
id: 'ru_123',
slug: null,
deleted: true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: getRedirectUrlList()
description: Use Clerk's Backend SDK to retrieve a list of white-listed redirect URLs.
---

{/* clerk/javascript file: https://github.com/clerk/javascript/blob/main/packages/backend/src/api/endpoints/RedirectUrlApi.ts#L13 */}

# `getRedirectUrlList()`

Retrieves a list of all white-listed redirect URLs.
Expand All @@ -13,7 +15,7 @@ function getRedirectUrlList(): () => Promise<PaginatedResourceResponse<RedirectU

## Example

In this example, you can see that the returned [`PaginatedResourceResponse`](/docs/references/backend/types/paginated-resource-response) includes `data`, which is an array of `RedirectUrl` objects, and `totalCount`, which indicates the total number of redirect URLs in the system.
In this example, you can see that the returned [`PaginatedResourceResponse`](/docs/references/backend/types/paginated-resource-response) includes `data`, which is an array of [`RedirectUrl`](/docs/references/backend/types/backend-redirect-url) objects, and `totalCount`, which indicates the total number of redirect URLs for the application.

```tsx
const response = await clerkClient.redirectUrls.getRedirectUrlList();
Expand All @@ -23,7 +25,7 @@ console.log(response);
{
data: [
_RedirectUrl {
id: 'ru_2bxLHVfYsA13r8iKHWoY8SAr9az',
id: 'ru_123',
url: 'https://example.com',
createdAt: 1707151695693,
updatedAt: 1707151695693
Expand Down
8 changes: 5 additions & 3 deletions docs/references/backend/redirect-urls/get-redirect-url.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ title: getRedirectUrl()
description: Use Clerk's Backend SDK to retrieve a single redirect URL by its ID.
---

{/* clerk/javascript file: https://github.com/clerk/javascript/blob/main/packages/backend/src/api/endpoints/RedirectUrlApi.ts#L21 */}

# `getRedirectUrl()`

Retrieves a single redirect URL by its ID, if the ID is valid.
Retrieves a single [`RedirectUrl`](/docs/references/backend/types/backend-redirect-url).

```tsx
function getRedirectUrl: (redirectUrlId: string) => Promise<RedirectUrl>;
Expand All @@ -20,14 +22,14 @@ function getRedirectUrl: (redirectUrlId: string) => Promise<RedirectUrl>;
## Example

```tsx
const redirectUrlId = 'ru_2bxLHVfYsA13r8iKHWoY8SAr9az';
const redirectUrlId = 'ru_123';

const response = await clerkClient.redirectUrls.getRedirectUrl(redirectUrlId);

console.log(response);
/*
_RedirectUrl {
id: 'ru_2bxLHVfYsA13r8iKHWoY8SAr9az',
id: 'ru_123',
url: 'https://example.com',
createdAt: 1707151695693,
updatedAt: 1707151695693
Expand Down
19 changes: 19 additions & 0 deletions docs/references/backend/types/backend-redirect-url.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: The Backend RedirectUrl object
description: The Backend RedirectUrl object represents a redirect URL in your application. This object is used in the Backend API.
---

# The Backend `RedirectUrl` object

Redirect URLs are whitelisted URLs that facilitate secure authentication flows in native applications (e.g. React Native, Expo). In these contexts, Clerk ensures that security-critical nonces are passed only to the whitelisted URLs.

The Backend `RedirectUrl` object represents a redirect URL in your application. This object is used in the Backend API.

## Properties

| Name | Type | Description |
| --- | --- | --- |
| `id` | `string` | A unique identifier for the redirect URL. |
| `url` | `string` | The full URL value prefixed with `https://` or a custom scheme. For example, `https://my-app.com/oauth-callback` or `my-app://oauth-callback`. |
| `createdAt` | `number` | Date when the redirect URL was first created. |
| `updatedAt` | `number` | Date of the last time the redirect URL was updated. |

0 comments on commit 3bd1c7f

Please sign in to comment.