@lukoweb/apitogo 0.2.56 → 0.2.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/cli/cli.js +1026 -540
  2. package/dist/declarations/cli/platform/client/platform-api.d.ts +6 -0
  3. package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -0
  4. package/dist/declarations/lib/authentication/providers/openid.d.ts +2 -1
  5. package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -1
  6. package/dist/flat-config.d.ts +1 -0
  7. package/docs/cli/commands.md +50 -32
  8. package/docs/cli/go-live.md +66 -93
  9. package/docs/cli/overview.md +18 -17
  10. package/docs/cli/setup.md +130 -141
  11. package/docs/cli/shape.md +94 -11
  12. package/docs/components/slot.mdx +116 -119
  13. package/docs/configuration/api-reference.md +98 -397
  14. package/docs/configuration/authentication.md +118 -159
  15. package/docs/configuration/footer.mdx +89 -118
  16. package/docs/configuration/make-config.mdx +2 -2
  17. package/docs/configuration/overview.md +97 -166
  18. package/docs/configuration/plans.md +100 -110
  19. package/docs/configuration/portal.md +116 -0
  20. package/docs/customization/colors-theme.mdx +255 -278
  21. package/docs/customization/fonts.md +105 -110
  22. package/docs/customization/landing-page.md +189 -188
  23. package/docs/deploy/apitogo.md +13 -17
  24. package/docs/deployment.md +15 -9
  25. package/docs/guides/stripe-setup.mdx +123 -0
  26. package/docs/markdown/frontmatter.md +172 -173
  27. package/docs/mcp/go-live.md +100 -100
  28. package/docs/mcp/overview.md +76 -76
  29. package/docs/quickstart.md +88 -72
  30. package/docs/writing.mdx +68 -72
  31. package/package.json +1 -1
  32. package/src/config/v2/docs-navigation.ts +7 -2
  33. package/src/config/v2/index.ts +1 -0
  34. package/src/config/v2/resolve.ts +28 -0
  35. package/src/config/v2/rules.ts +32 -1
  36. package/src/config/v2/schema.ts +9 -0
  37. package/src/config/v2/services.ts +78 -2
  38. package/src/config/v2/starter-landing.ts +41 -0
  39. package/src/config/v2/wrapper.ts +127 -7
  40. package/src/config/validators/ZudokuConfig.ts +794 -792
  41. package/src/lib/authentication/providers/openid.tsx +6 -1
  42. package/src/lib/plugins/markdown/index.tsx +86 -82
  43. package/src/vite/dev-server.ts +9 -1
  44. package/src/vite/dev-ssr-config.ts +32 -0
  45. package/src/vite/plugin-config.ts +4 -2
  46. package/src/vite/plugin-docs.ts +213 -205
  47. package/docs/concepts/auth-provider-api-identities.md +0 -105
  48. package/docs/configuration/ai-assistants.md +0 -65
  49. package/docs/configuration/api-catalog.md +0 -109
  50. package/docs/configuration/authentication-auth0.md +0 -181
  51. package/docs/configuration/authentication-azure-ad.md +0 -245
  52. package/docs/configuration/authentication-clerk.md +0 -117
  53. package/docs/configuration/authentication-firebase.md +0 -69
  54. package/docs/configuration/authentication-pingfederate.md +0 -143
  55. package/docs/configuration/authentication-supabase.md +0 -233
  56. package/docs/configuration/build-configuration.mdx +0 -147
  57. package/docs/configuration/docs.md +0 -282
  58. package/docs/configuration/llms.md +0 -90
  59. package/docs/configuration/manifest.md +0 -129
  60. package/docs/configuration/navigation.mdx +0 -415
  61. package/docs/configuration/protected-routes.md +0 -150
  62. package/docs/configuration/search.md +0 -164
  63. package/docs/configuration/sentry.mdx +0 -44
  64. package/docs/configuration/site.md +0 -124
  65. package/docs/configuration/slots.mdx +0 -125
  66. package/docs/configuration/vite-config.md +0 -18
  67. package/docs/custom-plugins.md +0 -285
  68. package/docs/deploy/apache-nginx.md +0 -41
  69. package/docs/deploy/cloudflare-pages.md +0 -74
  70. package/docs/deploy/direct-upload.md +0 -17
  71. package/docs/deploy/github-pages.md +0 -49
  72. package/docs/deploy/vercel.md +0 -101
  73. package/docs/extending/events.md +0 -124
  74. package/docs/guides/environment-variables.md +0 -94
  75. package/docs/guides/managing-api-keys-and-identities.md +0 -89
  76. package/docs/guides/navigation-rules.mdx +0 -203
  77. package/docs/guides/processors.mdx +0 -234
  78. package/docs/guides/transforming-examples.md +0 -156
  79. package/docs/guides/using-multiple-apis.md +0 -87
  80. package/docs/plugins.md +0 -24
@@ -1,109 +0,0 @@
1
- ---
2
- title: API Catalog
3
- sidebar_icon: book-open
4
- ---
5
-
6
- If you're dealing with multiple APIs and multiple OpenAPI files, the API Catalog comes in handy. It
7
- creates an overview of all your APIs and lets you organize them into categories and tags.
8
-
9
- ## Enable API Catalog
10
-
11
- The first step to enable the API Catalog, you need to add a `catalogs` object to your APIToGo
12
- configuration file.
13
-
14
- ```js title=config
15
- const config = {
16
- // ...
17
- catalogs: {
18
- path: "/catalog",
19
- label: "API Catalog",
20
- },
21
- // ...
22
- };
23
- ```
24
-
25
- You can then add your APIs to the catalog by adding the `categories` property to your API
26
- configuration.
27
-
28
- ```js title=config
29
- const config = {
30
- // ...
31
- apis: [
32
- // ...
33
- {
34
- type: "file",
35
- input: "./operational.json",
36
- path: "/api-operational",
37
- categories: [{ label: "General", tags: ["Operational"] }],
38
- },
39
- {
40
- type: "file",
41
- input: "./enduser.json",
42
- path: "/api-enduser",
43
- categories: [{ label: "General", tags: ["End-User"] }],
44
- },
45
- {
46
- type: "file",
47
- input: "./openapi.json",
48
- path: "/api-auth",
49
- categories: [{ label: "Other", tags: ["Authentication"] }],
50
- },
51
- // ...
52
- ],
53
- // ...
54
- };
55
- ```
56
-
57
- ## Advanced Configuration
58
-
59
- ### Select APIs to show in the catalog
60
-
61
- You can select which APIs are shown in the catalog by using the `items` property. The `items`
62
- property is an array of navigation IDs of the APIs you want to show in the catalog.
63
-
64
- ```js title=config
65
- const config = {
66
- // ...
67
- catalogs: {
68
- path: "/catalog",
69
- label: "API Catalog",
70
- // Only show the operational API in the catalog
71
- items: ["api-operational"],
72
- },
73
- apis: [
74
- // ...
75
- {
76
- type: "file",
77
- input: "./operational.json",
78
- path: "/api-operational",
79
- categories: [{ label: "General", tags: ["Operational"] }],
80
- },
81
- {
82
- type: "file",
83
- input: "./enduser.json",
84
- path: "/api-enduser",
85
- categories: [{ label: "General", tags: ["End-User"] }],
86
- },
87
- ],
88
- // ...
89
- };
90
- ```
91
-
92
- ### Filtering catalog items
93
-
94
- You can filter which APIs are shown in the catalog by using the `filterItems` property. The function
95
- receives the items and context as arguments.
96
-
97
- ```js title=config
98
- const config = {
99
- // ...
100
- catalogs: {
101
- path: "/catalog",
102
- label: "API Catalog",
103
- filterItems: (items, { auth: AuthState }) => {
104
- return items.filter((items) => items.tags.includes(auth));
105
- },
106
- },
107
- // ...
108
- };
109
- ```
@@ -1,181 +0,0 @@
1
- ---
2
- title: Auth0 Setup
3
- sidebar_label: Auth0
4
- description:
5
- Learn how to set up Auth0 authentication for APIToGo, including application configuration and
6
- integration steps for secure API documentation access.
7
- ---
8
-
9
- :::caution{title="SPA / advanced"}
10
-
11
- Portal products on APItoGo use [`dev-portal`](./authentication.md) authentication. Use Auth0 SPA
12
- integration only for standalone docs sites that talk to Auth0 directly.
13
-
14
- :::
15
-
16
- Auth0 is a flexible authentication and authorization platform that integrates seamlessly with
17
- APIToGo. This guide walks you through setting up Auth0 authentication for your documentation site.
18
-
19
- ## Prerequisites
20
-
21
- If you don't have an Auth0 account, you can sign up for a
22
- [free Auth0 account](https://auth0.com/signup) that provides 7,000 monthly active users.
23
-
24
- ## Setup Steps
25
-
26
- <Stepper>
27
-
28
- 1. **Create Auth0 Application**
29
-
30
- [Create a new Auth0 application](https://auth0.com/docs/get-started/auth0-overview/create-applications)
31
- in the Auth0 dashboard:
32
- - Select type **Single Page Web Applications**
33
- - Give your application a descriptive name
34
-
35
- 2. **Configure Auth0 Application**
36
-
37
- In your Auth0 application settings, configure the following:
38
-
39
- **Application URLs:**
40
- - **Allowed Callback URLs**:
41
- - Production: `https://your-site.com/oauth/callback`
42
- - Preview (wildcard): `https://*.your-domain.com/oauth/callback`
43
- - Local Development: `http://localhost:3000/oauth/callback`
44
- - **Allowed Logout URLs**: Same as callback URLs above
45
-
46
- - **Allowed Web Origins**:
47
- - Production: `https://your-site.com`
48
- - Preview (wildcard): `https://*.your-domain.com`
49
- - Local development: `http://localhost:3000`
50
-
51
- **Refresh Token Rotation:**
52
- - **Allow Refresh Token Rotation**: Enabled
53
- - **Rotation Overlap Period**: 0 seconds (recommended)
54
-
55
- Keep the default **Refresh Token Expiration** settings unless you have specific requirements.
56
-
57
- 3. Create an Auth0 API:
58
- - Navigate to the [APIs section](https://manage.auth0.com/#/apis) in the Auth0 dashboard
59
- - Click **Create API**
60
- - Set a name (e.g., "APIToGo API") and an identifier (e.g., `https://your-domain.com/api`)
61
- - Choose **RS256** as the signing algorithm
62
- - Save the API
63
-
64
- :::warning
65
-
66
- This step is important. If you skip creating an API, APIToGo will not be able to validate the
67
- tokens issued by Auth0, leading to authentication failures.
68
-
69
- :::
70
-
71
- 4. **Configure APIToGo**
72
-
73
- Add the Auth0 configuration to your [APIToGo configuration file](./overview.md):
74
-
75
- ```typescript
76
- // site config
77
- export default {
78
- // ... other configuration
79
- authentication: {
80
- type: "auth0",
81
- domain: "your-domain.us.auth0.com",
82
- clientId: "<your-auth0-client-id>",
83
- audience: "https://your-domain.com/api", // Your Auth0 API identifier
84
- },
85
- // ... other configuration
86
- };
87
- ```
88
-
89
- Where:
90
- - **domain**: Your Auth0 domain (found in your application's Basic Information)
91
- - **clientId**: The Client ID from your Auth0 application settings
92
- - **audience**: The identifier of the Auth0 API you created (e.g., `https://your-domain.com/api`)
93
-
94
- </Stepper>
95
-
96
- ## Advanced Configuration
97
-
98
- ### Custom Scopes
99
-
100
- If you need additional scopes for your API access, you can specify them in the configuration:
101
-
102
- ```typescript
103
- authentication: {
104
- type: "auth0",
105
- domain: "your-domain.us.auth0.com",
106
- clientId: "<your-auth0-client-id>",
107
- scopes: ["openid", "profile", "email", "read:api", "write:api"],
108
- }
109
- ```
110
-
111
- ### Enabling Logout
112
-
113
- APIToGo supports logout functionality for Auth0 tenants. For tenants created **on or after November
114
- 14, 2023**, logout is automatically enabled through the OIDC
115
- [RP-Initiated Logout](https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0)
116
- endpoint.
117
-
118
- To enable logout for your Auth0 application:
119
-
120
- 1. Ensure your **Allowed Logout URLs** are configured in Auth0 (see
121
- [Configure Auth0 Application](#setup-steps) above)
122
- 2. The logout URL should match your callback URL pattern (e.g., `https://your-site.com/` for
123
- production)
124
-
125
- For older tenants, you may need to enable **RP-Initiated Logout** in your tenant settings. See the
126
- [Auth0 logout documentation](https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0)
127
- for details.
128
-
129
- ### Customizing the Prompt Parameter
130
-
131
- By default, APIToGo sets `prompt="login"` in the Auth0 authorization request, which forces users to
132
- re-enter their credentials even if they have a valid session. You can customize this behavior using
133
- the `options.prompt` configuration:
134
-
135
- ```typescript
136
- authentication: {
137
- type: "auth0",
138
- domain: "your-domain.us.auth0.com",
139
- clientId: "<your-auth0-client-id>",
140
- audience: "https://your-domain.com/api",
141
- options: {
142
- prompt: "", // Omit the prompt parameter to allow silent authentication
143
- },
144
- }
145
- ```
146
-
147
- Valid values for the `prompt` parameter include:
148
-
149
- - `"login"` - Force users to re-enter their credentials even if they have a valid session (default)
150
- - `"consent"` - Force users to consent to authorization even if they previously consented
151
- - `"select_account"` - Force users to select an account (useful for multi-account scenarios)
152
- - `"none"` - No prompt is shown; silent authentication only
153
- - `""` (empty string) - Omit the prompt parameter, allowing Auth0 to handle authentication based on
154
- session state
155
-
156
- When the prompt parameter is omitted (empty string), Auth0 will:
157
-
158
- - Silently authenticate the user if they have a valid session
159
- - Redirect to the login page if no valid session exists
160
-
161
- ## Troubleshooting
162
-
163
- ### Common Issues
164
-
165
- 1. **Callback URL Mismatch**: Ensure your callback URLs in Auth0 exactly match your site's URL,
166
- including the `/oauth/callback` path.
167
-
168
- 2. **CORS Errors**: Add your site's domain to the Allowed Web Origins in Auth0.
169
-
170
- 3. **Authentication Loop**: Check that your Auth0 domain includes the protocol (`https://`) but no
171
- trailing slash.
172
-
173
- 4. **Token Validation Errors**: Ensure the audience in your APIToGo configuration matches the
174
- identifier of the Auth0 API you created.
175
-
176
- ## Next Steps
177
-
178
- - Learn about [protecting routes](./authentication.md#protected-routes) in your documentation
179
- - Explore other [authentication providers](./authentication.md#authentication-providers) supported
180
- by APIToGo
181
- - Configure [user permissions](./authentication.md#user-data) based on Auth0 roles
@@ -1,245 +0,0 @@
1
- ---
2
- title: Azure AD Setup
3
- sidebar_label: Azure AD
4
- description:
5
- Learn how to set up Azure Active Directory (Microsoft Entra ID) authentication for APIToGo,
6
- enabling secure single sign-on for your organization.
7
- ---
8
-
9
- :::caution{title="SPA / advanced"}
10
-
11
- Portal products on APItoGo use [`dev-portal`](./authentication.md) authentication. Use Azure AD SPA
12
- integration only for standalone docs sites that talk to Entra ID directly.
13
-
14
- :::
15
-
16
- Azure Active Directory (now Microsoft Entra ID) provides enterprise-grade authentication and
17
- authorization for organizations using Microsoft's cloud identity platform. This guide shows you how
18
- to integrate Azure AD with your APIToGo documentation site.
19
-
20
- ## Prerequisites
21
-
22
- - An Azure subscription with Azure Active Directory
23
- - Administrative access to register applications in Azure AD
24
- - Your Azure AD tenant ID
25
-
26
- ## Setup Steps
27
-
28
- <Stepper>
29
-
30
- 1. **Register an Application in Azure AD**
31
-
32
- In the [Azure Portal](https://portal.azure.com):
33
- - Navigate to **Azure Active Directory** → **App registrations**
34
- - Click **New registration**
35
- - Configure your application:
36
- - **Name**: Enter a descriptive name (e.g., "APIToGo Documentation")
37
- - **Supported account types**: Choose based on your needs:
38
- - Single tenant (your organization only)
39
- - Multitenant (any Azure AD directory)
40
- - Multitenant + personal Microsoft accounts
41
- - **Redirect URI**:
42
- - Platform: **Single-page application (SPA)**
43
- - URI: `https://your-site.com/oauth/callback`
44
- - Click **Register**
45
-
46
- 2. **Configure Authentication Settings**
47
-
48
- In your newly registered application:
49
- - Go to **Authentication** in the left menu
50
- - Under **Single-page application**, add redirect URIs:
51
- - Production: `https://your-site.com/oauth/callback`
52
- - Preview (wildcard): `https://*.your-domain.com/oauth/callback`
53
- - Local Development: `http://localhost:3000/oauth/callback`
54
- - Under **Implicit grant and hybrid flows**:
55
- - Enable **ID tokens**
56
- - Enable **Access tokens**
57
- - Configure **Supported account types** if needed
58
- - Save your changes
59
-
60
- 3. **Configure API Permissions (Optional)**
61
-
62
- If you need specific permissions:
63
- - Go to **API permissions**
64
- - Click **Add a permission**
65
- - Select **Microsoft Graph** → **Delegated permissions**
66
- - Add permissions like `User.Read`, `email`, `profile`, `openid`
67
- - Grant admin consent if required by your organization
68
-
69
- 4. **Configure APIToGo**
70
-
71
- Get your application details from the Azure Portal:
72
- - Go to **Overview** page of your app registration
73
- - Copy the **Application (client) ID**
74
- - Copy the **Directory (tenant) ID**
75
-
76
- Add the configuration to your [APIToGo configuration file](./overview.md):
77
-
78
- ```typescript
79
- // site config
80
- export default {
81
- // ... other configuration
82
- authentication: {
83
- type: "openid",
84
- clientId: "<your-application-client-id>",
85
- issuer: "https://login.microsoftonline.com/<your-tenant-id>/v2.0",
86
- scopes: ["openid", "profile", "email"], // Optional: customize scopes
87
- },
88
- // ... other configuration
89
- };
90
- ```
91
-
92
- 5. **Install Azure AD Dependencies**
93
-
94
- Add `@azure/msal-browser` to your project dependencies:
95
-
96
- ```bash
97
- npm install @azure/msal-browser
98
- ```
99
-
100
- </Stepper>
101
-
102
- ## Configuration Options
103
-
104
- ### Single Tenant vs Multitenant
105
-
106
- For single tenant (organization-only access):
107
-
108
- ```typescript
109
- authentication: {
110
- type: "openid",
111
- clientId: "<your-application-client-id>",
112
- issuer: "https://login.microsoftonline.com/<your-tenant-id>/v2.0",
113
- scopes: ["openid", "profile", "email"],
114
- }
115
- ```
116
-
117
- For multitenant (any Azure AD organization):
118
-
119
- ```typescript
120
- authentication: {
121
- type: "openid",
122
- clientId: "<your-application-client-id>",
123
- issuer: "https://login.microsoftonline.com/common/v2.0",
124
- scopes: ["openid", "profile", "email"],
125
- }
126
- ```
127
-
128
- ### Custom Scopes and Permissions
129
-
130
- Request additional Microsoft Graph API scopes:
131
-
132
- ```typescript
133
- authentication: {
134
- type: "openid",
135
- clientId: "<your-application-client-id>",
136
- issuer: "https://login.microsoftonline.com/<your-tenant-id>/v2.0",
137
- scopes: [
138
- "openid",
139
- "profile",
140
- "email",
141
- "User.Read",
142
- "GroupMember.Read.All" // For group-based access control
143
- ],
144
- }
145
- ```
146
-
147
- ### Protected Routes
148
-
149
- Protect specific documentation routes using the `protectedRoutes` configuration:
150
-
151
- ```typescript
152
- {
153
- // ... other configuration
154
- authentication: {
155
- type: "openid",
156
- // ... Azure AD config
157
- },
158
- protectedRoutes: [
159
- "/api/*", // Protect all API documentation
160
- "/internal/*", // Protect internal documentation
161
- "/admin/*" // Protect admin sections
162
- ],
163
- }
164
- ```
165
-
166
- ## Advanced Configuration
167
-
168
- ### Conditional Access Policies
169
-
170
- Azure AD supports conditional access policies that can:
171
-
172
- - Require multi-factor authentication
173
- - Restrict access by location
174
- - Enforce device compliance
175
- - Control session lifetime
176
-
177
- Configure these in Azure AD Portal under **Security** → **Conditional Access**.
178
-
179
- ### App Roles and Groups
180
-
181
- To implement role-based access control:
182
-
183
- 1. In your app registration, go to **App roles**
184
- 2. Create custom roles (e.g., "Documentation.Read", "Documentation.Admin")
185
- 3. Assign roles to users or groups in **Enterprise applications**
186
- 4. Access role claims in your application
187
-
188
- ### B2B Guest Access
189
-
190
- To allow external partners access:
191
-
192
- 1. Enable B2B collaboration in Azure AD
193
- 2. Configure external collaboration settings
194
- 3. Invite guest users to your directory
195
- 4. Grant appropriate permissions to your application
196
-
197
- ## User Data
198
-
199
- Azure AD provides rich user profile data through OpenID Connect:
200
-
201
- - `name` - User's display name
202
- - `email` - User's email address
203
- - `picture` - Profile picture URL (when available)
204
- - `email_verified` - Email verification status
205
- - `preferred_username` - User's UPN (User Principal Name)
206
- - Additional claims based on your API permissions
207
-
208
- ## Troubleshooting
209
-
210
- ### Common Issues
211
-
212
- 1. **Invalid Client Error**: Ensure the client ID is correct and the application is properly
213
- registered.
214
-
215
- 2. **Redirect URI Mismatch**: The redirect URI must exactly match one configured in Azure AD,
216
- including protocol and path.
217
-
218
- 3. **Tenant Access Issues**: For single-tenant apps, ensure users are from the correct tenant. For
219
- multi-tenant, verify the issuer URL uses "common" or "organizations".
220
-
221
- 4. **Missing User Information**: Check that required API permissions are granted and admin consent
222
- is provided if needed.
223
-
224
- 5. **Token Validation Errors**: Ensure your issuer URL is correct and includes the `/v2.0` endpoint
225
- for the Microsoft identity platform.
226
-
227
- 6. **Authentication Not Working**: Make sure you have installed `@azure/msal-browser` to your
228
- project.
229
-
230
- ## Security Best Practices
231
-
232
- - Use single-tenant configuration unless multi-tenant is specifically required
233
- - Implement conditional access policies for sensitive documentation
234
- - Regularly review and audit app permissions
235
- - Monitor sign-in logs in Azure AD for suspicious activity
236
- - Use app roles for fine-grained access control
237
-
238
- ## Next Steps
239
-
240
- - Explore
241
- [Microsoft identity platform documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/)
242
- - Learn about [protecting routes](./authentication.md#protected-routes) in your documentation
243
- - Implement
244
- [app roles](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps)
245
- for advanced authorization
@@ -1,117 +0,0 @@
1
- ---
2
- title: Clerk Setup
3
- sidebar_label: Clerk
4
- description:
5
- Learn how to set up Clerk authentication for APIToGo, providing a seamless authentication
6
- experience with modern UI components and extensive customization options.
7
- ---
8
-
9
- :::caution{title="SPA / advanced"}
10
-
11
- Portal products on APItoGo use [`dev-portal`](./authentication.md) authentication. Use Clerk SPA
12
- integration only for standalone docs sites that talk to Clerk directly.
13
-
14
- :::
15
-
16
- Clerk is a modern authentication platform that provides beautiful, customizable UI components and a
17
- developer-friendly experience. This guide walks you through integrating Clerk authentication with
18
- your APIToGo documentation site.
19
-
20
- ## Prerequisites
21
-
22
- If you don't have a Clerk account, you can sign up for a [free Clerk account](https://clerk.com/)
23
- that provides 10,000 monthly active users.
24
-
25
- ## Setup Steps
26
-
27
- <Stepper>
28
-
29
- 1. **Create a Clerk Application**
30
-
31
- In the [Clerk Dashboard](https://dashboard.clerk.com/):
32
- - Click **Create Application**
33
- - Enter your application name
34
- - Select your preferred authentication methods (email, social providers, etc.)
35
- - Click **Create Application**
36
-
37
- 2. **Create a Clerk JWT Template** You need to create a JWT Template so your JWTs include name,
38
- email and email_verified information.
39
-
40
- - Navigate to **JWT templates** in the [Clerk Dashboard](https://dashboard.clerk.com/)
41
- - Create a new template by clicking **Add new template**
42
- - Pick a name for the template
43
- - Add the following claims
44
- ```json
45
- {
46
- "name": "{{user.full_name}}",
47
- "email": "{{user.primary_email_address}}",
48
- "email_verified": "{{user.email_verified}}"
49
- }
50
- ```
51
- - Save
52
-
53
- 3. **Configure APIToGo**
54
-
55
- Get your publishable key from the Clerk dashboard:
56
- - Navigate to **API Keys** in your Clerk dashboard
57
- - Copy the **Publishable key**
58
-
59
- Use the JWT template name defined in the previous section
60
-
61
- Add the Clerk configuration to your [APIToGo configuration file](./overview.md):
62
-
63
- ```typescript
64
- // site config
65
- export default {
66
- // ... other configuration
67
- authentication: {
68
- type: "clerk",
69
- clerkPubKey: "<your-clerk-publishable-key>",
70
- jwtTemplateName: "<your-clerk-jwt-template-name>",
71
- },
72
- // ... other configuration
73
- };
74
- ```
75
-
76
- 4. **Configure Redirect URLs (Optional)**
77
-
78
- If you need custom redirect behavior, configure the allowed redirect URLs in Clerk:
79
- - Go to **Paths** in your Clerk dashboard
80
- - Add your production, preview, and local development URLs to the allowed redirect URLs
81
- - Common patterns:
82
- - Production: `https://your-site.com/oauth/callback`
83
- - Preview (wildcard): `https://*.your-domain.com/oauth/callback`
84
- - Local Development: `http://localhost:3000/oauth/callback`
85
-
86
- 5. **Install Clerk Dependencies**
87
-
88
- Add `@clerk/clerk-js` to your project dependencies:
89
-
90
- ```bash
91
- npm install @clerk/clerk-js
92
- ```
93
-
94
- </Stepper>
95
-
96
- ## Troubleshooting
97
-
98
- ### Common Issues
99
-
100
- 1. **Invalid Publishable Key**: Ensure you're using the publishable key (starts with `pk_`) and not
101
- the secret key.
102
-
103
- 2. **Authentication Not Working**: Verify that your Clerk application is active and not in
104
- development mode when deploying to production.
105
-
106
- 3. **Redirect Issues**: Check that your domain is added to the allowed redirect URLs in Clerk if
107
- using custom redirects.
108
-
109
- 4. **ReferenceError: can't access lexical declaration 'xxx' before initialization**: Make sure you
110
- have installed Clerk to your project.
111
-
112
- ## Next Steps
113
-
114
- - Explore [Clerk's documentation](https://clerk.com/docs) for advanced features
115
- - Learn about [protecting routes](./authentication.md#protected-routes) in your documentation
116
- - Configure [user roles and permissions](https://clerk.com/docs/organizations/roles-permissions) in
117
- Clerk