Skip to content

Commit d0a028b

Browse files
authored
Merge pull request #665 from devforth/feature/AdminForth/1717/add-clerk-oauth-adapter
fix: add docs for clerk adapter
2 parents 32d76c8 + 0e81865 commit d0a028b

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

adminforth/documentation/docs/tutorial/06-Adapters/02-oauth2-adapters.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,12 @@ Supports login through Microsoft accounts including Azure AD, Office365, and Out
5454
pnpm i @adminforth/oauth-adapter-twitch
5555
```
5656

57-
Adds support for Twitch authentication, useful for streaming or creator-oriented platforms.
57+
Adds support for Twitch authentication, useful for streaming or creator-oriented platforms.
58+
59+
## Clerk OAuth Adapter
60+
61+
```bash
62+
pnpm i @adminforth/clerk-oauth-adapter
63+
```
64+
65+
Enables sign-in via [Clerk](https://clerk.com/) — a hosted authentication platform with built-in user management, MFA, and social logins.

adminforth/documentation/docs/tutorial/09-Plugins/11-oauth.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,49 @@ plugins: [
476476
]
477477
```
478478

479+
### Clerk Adapter
480+
481+
Install Adapter:
482+
483+
```bash
484+
pnpm install @adminforth/clerk-oauth-adapter --save
485+
```
486+
487+
1. Go to the [Clerk Dashboard](https://dashboard.clerk.com) and open your application.
488+
2. In the left sidebar, go to **Configure****Developers****OAuth Applications**.
489+
3. Click **Add OAuth Application** and give it a name.
490+
4. Copy the **Client Secret** from the OAuth application creation modal.
491+
5. After copying, Clerk redirects you to the application page, where you can copy the **Client ID** and **Domain**.
492+
6. Add the credentials to your `.env` file:
493+
7. In **Redirect URLs**, add `https://your-domain/oauth/callback` and `http://localhost:3500/oauth/callback`. Include `baseUrl` when your AdminForth app uses it, for example `https://your-domain/base/oauth/callback`.
494+
8. In **Scopes**, check the **openid** checkbox.
495+
496+
```bash
497+
CLERK_CLIENT_ID=your_clerk_client_id
498+
CLERK_CLIENT_SECRET=your_clerk_client_secret
499+
CLERK_DOMAIN=https://your-app.clerk.accounts.dev
500+
```
501+
502+
Add the adapter to your plugin configuration:
503+
504+
```typescript title="./resources/adminuser.ts"
505+
import AdminForthAdapterClerkOauth2 from '@adminforth/clerk-oauth-adapter';
506+
507+
// ... existing resource configuration ...
508+
plugins: [
509+
new OAuthPlugin({
510+
adapters: [
511+
...
512+
new AdminForthAdapterClerkOauth2({
513+
clientID: process.env.CLERK_CLIENT_ID as string,
514+
clientSecret: process.env.CLERK_CLIENT_SECRET as string,
515+
domain: process.env.CLERK_DOMAIN as string,
516+
}),
517+
],
518+
}),
519+
]
520+
```
521+
479522
### Need custom provider?
480523

481524
Just fork any existing adapter e.g. [Google](https://github.com/devforth/adminforth-oauth-adapter-google) and adjust it to your needs.

0 commit comments

Comments
 (0)