zuplo 6.68.10 → 6.68.16
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.
- package/docs/articles/troubleshooting-slow-responses.mdx +72 -0
- package/docs/dev-portal/zudoku/configuration/api-reference.md +5 -0
- package/docs/dev-portal/zudoku/configuration/authentication-auth0.md +2 -2
- package/docs/dev-portal/zudoku/configuration/authentication-azure-ad.md +4 -13
- package/docs/dev-portal/zudoku/configuration/authentication-clerk.md +17 -16
- package/docs/dev-portal/zudoku/configuration/authentication-firebase.md +1 -1
- package/docs/dev-portal/zudoku/configuration/authentication-supabase.md +165 -44
- package/docs/dev-portal/zudoku/configuration/authentication.md +7 -7
- package/docs/dev-portal/zudoku/configuration/oauth-security-schemes.md +122 -0
- package/docs/dev-portal/zudoku/configuration/site.md +39 -0
- package/package.json +4 -4
|
@@ -234,6 +234,76 @@ performance. Use it to:
|
|
|
234
234
|
- Spot error rate spikes that may correlate with latency issues
|
|
235
235
|
- Track request volume trends that may indicate capacity-related slowness
|
|
236
236
|
|
|
237
|
+
### OpenTelemetry Tracing
|
|
238
|
+
|
|
239
|
+
For the most detailed view of where time is spent in your request pipeline,
|
|
240
|
+
enable [OpenTelemetry tracing](./opentelemetry.mdx). The OpenTelemetry plugin
|
|
241
|
+
automatically instruments your API and provides span-level timing for each stage
|
|
242
|
+
of the request lifecycle — including inbound policies, the handler, outbound
|
|
243
|
+
policies, and any subrequests made via `fetch` in custom code.
|
|
244
|
+
|
|
245
|
+
<EnterpriseFeature name="OpenTelemetry" />
|
|
246
|
+
|
|
247
|
+
With tracing enabled, you can see exactly how long each policy and handler takes
|
|
248
|
+
to execute, making it straightforward to identify which component is adding
|
|
249
|
+
latency. The plugin also supports W3C trace propagation, so you can follow a
|
|
250
|
+
request all the way from the client through Zuplo to your backend.
|
|
251
|
+
|
|
252
|
+
To get started, add the `OpenTelemetryPlugin` in your `zuplo.runtime.ts` file
|
|
253
|
+
and configure it to export trace data to any OpenTelemetry-compatible service
|
|
254
|
+
such as [Honeycomb](https://honeycomb.io), [Dynatrace](https://dynatrace.com),
|
|
255
|
+
[Jaeger](https://www.jaegertracing.io/), or an
|
|
256
|
+
[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/):
|
|
257
|
+
|
|
258
|
+
```ts title="zuplo.runtime.ts"
|
|
259
|
+
import { OpenTelemetryPlugin } from "@zuplo/otel";
|
|
260
|
+
import { RuntimeExtensions, environment } from "@zuplo/runtime";
|
|
261
|
+
|
|
262
|
+
export function runtimeInit(runtime: RuntimeExtensions) {
|
|
263
|
+
runtime.addPlugin(
|
|
264
|
+
new OpenTelemetryPlugin({
|
|
265
|
+
exporter: {
|
|
266
|
+
url: "https://otel-collector.example.com/v1/traces",
|
|
267
|
+
headers: {
|
|
268
|
+
"api-key": environment.OTEL_API_KEY,
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
service: {
|
|
272
|
+
name: "my-api",
|
|
273
|
+
version: "1.0.0",
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
You can also add custom spans within your policies to trace specific operations:
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
import { ZuploContext, ZuploRequest } from "@zuplo/runtime";
|
|
284
|
+
import { trace } from "@opentelemetry/api";
|
|
285
|
+
|
|
286
|
+
export default async function policy(
|
|
287
|
+
request: ZuploRequest,
|
|
288
|
+
context: ZuploContext,
|
|
289
|
+
) {
|
|
290
|
+
const tracer = trace.getTracer("my-tracer");
|
|
291
|
+
return tracer.startActiveSpan("my-custom-operation", async (span) => {
|
|
292
|
+
span.setAttribute("endpoint", request.url);
|
|
293
|
+
|
|
294
|
+
try {
|
|
295
|
+
// ... policy logic with external calls ...
|
|
296
|
+
return request;
|
|
297
|
+
} finally {
|
|
298
|
+
span.end();
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
For the full configuration reference, including sampling, post-processing, and
|
|
305
|
+
logging, see the [OpenTelemetry documentation](./opentelemetry.mdx).
|
|
306
|
+
|
|
237
307
|
### Logging Integrations
|
|
238
308
|
|
|
239
309
|
For deeper analysis, configure one of Zuplo's
|
|
@@ -290,6 +360,8 @@ back-and-forth diagnostic questions.
|
|
|
290
360
|
|
|
291
361
|
## Related Resources
|
|
292
362
|
|
|
363
|
+
- [OpenTelemetry](./opentelemetry.mdx) — Distributed tracing and logging for
|
|
364
|
+
detailed request lifecycle visibility
|
|
293
365
|
- [Performance Testing Your API Gateway](./performance-testing.mdx) — How to
|
|
294
366
|
benchmark and compare gateway performance accurately
|
|
295
367
|
- [Proactive Monitoring](./monitoring-your-gateway.mdx) — Setting up health
|
|
@@ -206,6 +206,7 @@ const config = {
|
|
|
206
206
|
],
|
|
207
207
|
disablePlayground: false, // Disable the interactive API playground
|
|
208
208
|
disableSidecar: false, // Disable the sidecar completely
|
|
209
|
+
disableSecurity: true, // Disable security scheme display and playground auth (default)
|
|
209
210
|
showVersionSelect: "if-available", // Control version selector visibility
|
|
210
211
|
expandAllTags: true, // Control initial expanded state of tag categories
|
|
211
212
|
showInfoPage: true, // Show API information page as the index route
|
|
@@ -224,6 +225,9 @@ Available options:
|
|
|
224
225
|
identifier) and `label` (display name)
|
|
225
226
|
- `disablePlayground`: Disable the interactive API playground globally
|
|
226
227
|
- `disableSidecar`: Disable the sidecar panel completely
|
|
228
|
+
- `disableSecurity`: Disable OpenAPI security scheme display (auth badges on operations, security
|
|
229
|
+
schemes section on the info page, and the Authorize dialog in the playground). Disabled by default
|
|
230
|
+
(`true`). Set to `false` to enable security scheme support
|
|
227
231
|
- `showVersionSelect`: Control version selector visibility
|
|
228
232
|
- `"if-available"`: Show version selector only when multiple versions exist (default)
|
|
229
233
|
- `"always"`: Always show version selector (disabled if only one version)
|
|
@@ -251,6 +255,7 @@ const config = {
|
|
|
251
255
|
examplesLanguage: "shell", // Default language for code examples
|
|
252
256
|
disablePlayground: false, // Disable the interactive API playground
|
|
253
257
|
disableSidecar: false, // Disable the sidecar completely
|
|
258
|
+
disableSecurity: true, // Disable security scheme display and playground auth (default)
|
|
254
259
|
showVersionSelect: "if-available", // Control version selector visibility
|
|
255
260
|
expandAllTags: false, // Control initial expanded state of tag categories
|
|
256
261
|
showInfoPage: true, // Show API information page as the index route
|
|
@@ -160,8 +160,8 @@ When the prompt parameter is omitted (empty string), Auth0 will:
|
|
|
160
160
|
|
|
161
161
|
2. **CORS Errors**: Add your site's domain to the Allowed Web Origins in Auth0.
|
|
162
162
|
|
|
163
|
-
3. **Authentication Loop**: Check that your Auth0 domain
|
|
164
|
-
trailing slash.
|
|
163
|
+
3. **Authentication Loop**: Check that your Auth0 domain is a plain hostname only (e.g.,
|
|
164
|
+
`your-domain.us.auth0.com`) without a protocol prefix (`https://`) or trailing slash.
|
|
165
165
|
|
|
166
166
|
4. **Token Validation Errors**: Ensure the audience in your Dev Portal configuration matches the
|
|
167
167
|
identifier of the Auth0 API you created.
|
|
@@ -44,9 +44,8 @@ to integrate Azure AD with your Dev Portal documentation site.
|
|
|
44
44
|
- Production: `https://your-site.com/oauth/callback`
|
|
45
45
|
- Preview (wildcard): `https://*.your-domain.com/oauth/callback`
|
|
46
46
|
- Local Development: `http://localhost:3000/oauth/callback`
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
- Enable **Access tokens**
|
|
47
|
+
- **Implicit grant and hybrid flows** should remain **disabled** — Dev Portal uses the more secure
|
|
48
|
+
Authorization Code flow with PKCE
|
|
50
49
|
- Configure **Supported account types** if needed
|
|
51
50
|
- Save your changes
|
|
52
51
|
|
|
@@ -82,14 +81,6 @@ to integrate Azure AD with your Dev Portal documentation site.
|
|
|
82
81
|
};
|
|
83
82
|
```
|
|
84
83
|
|
|
85
|
-
5. **Install Azure AD Dependencies**
|
|
86
|
-
|
|
87
|
-
Add `@azure/msal-browser` to your project dependencies:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npm install @azure/msal-browser
|
|
91
|
-
```
|
|
92
|
-
|
|
93
84
|
</Stepper>
|
|
94
85
|
|
|
95
86
|
## Configuration Options
|
|
@@ -217,8 +208,8 @@ Azure AD provides rich user profile data through OpenID Connect:
|
|
|
217
208
|
5. **Token Validation Errors**: Ensure your issuer URL is correct and includes the `/v2.0` endpoint
|
|
218
209
|
for the Microsoft identity platform.
|
|
219
210
|
|
|
220
|
-
6. **Authentication Not Working**:
|
|
221
|
-
|
|
211
|
+
6. **Authentication Not Working**: Verify your issuer URL and client ID are correct, and that your
|
|
212
|
+
app registration is configured as a Single-page application (SPA) with the correct redirect URIs.
|
|
222
213
|
|
|
223
214
|
## Security Best Practices
|
|
224
215
|
|
|
@@ -68,23 +68,23 @@ that provides 10,000 monthly active users.
|
|
|
68
68
|
|
|
69
69
|
4. **Configure Redirect URLs (Optional)**
|
|
70
70
|
|
|
71
|
-
If you need custom redirect behavior,
|
|
72
|
-
|
|
73
|
-
- Add your production, preview, and local development URLs to the allowed redirect URLs
|
|
74
|
-
- Common patterns:
|
|
75
|
-
- Production: `https://your-site.com/oauth/callback`
|
|
76
|
-
- Preview (wildcard): `https://*.your-domain.com/oauth/callback`
|
|
77
|
-
- Local Development: `http://localhost:3000/oauth/callback`
|
|
71
|
+
If you need custom redirect behavior after sign-in or sign-up, you can configure this in your
|
|
72
|
+
Dev Portal config:
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
```typescript
|
|
75
|
+
authentication: {
|
|
76
|
+
type: "clerk",
|
|
77
|
+
clerkPubKey: "<your-clerk-publishable-key>",
|
|
78
|
+
jwtTemplateName: "<your-clerk-jwt-template-name>",
|
|
79
|
+
redirectToAfterSignIn: "/docs",
|
|
80
|
+
redirectToAfterSignUp: "/getting-started",
|
|
81
|
+
redirectToAfterSignOut: "/",
|
|
82
|
+
},
|
|
85
83
|
```
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
You should also ensure your site's domain is added as an allowed origin in the Clerk dashboard.
|
|
86
|
+
|
|
87
|
+
</Stepper>
|
|
88
88
|
|
|
89
89
|
## Troubleshooting
|
|
90
90
|
|
|
@@ -99,8 +99,9 @@ that provides 10,000 monthly active users.
|
|
|
99
99
|
3. **Redirect Issues**: Check that your domain is added to the allowed redirect URLs in Clerk if
|
|
100
100
|
using custom redirects.
|
|
101
101
|
|
|
102
|
-
4. **ReferenceError: can't access lexical declaration 'xxx' before initialization**:
|
|
103
|
-
|
|
102
|
+
4. **ReferenceError: can't access lexical declaration 'xxx' before initialization**: This can happen
|
|
103
|
+
if the Clerk CDN script fails to load. Check your network connectivity and ensure your
|
|
104
|
+
publishable key is valid.
|
|
104
105
|
|
|
105
106
|
## Next Steps
|
|
106
107
|
|
|
@@ -49,7 +49,7 @@ export default {
|
|
|
49
49
|
measurementId: "G-12W6TTNR75",
|
|
50
50
|
// Optional: specify which providers to show in the sign-in UI
|
|
51
51
|
// Available providers: "google", "github", "facebook", "twitter",
|
|
52
|
-
// "microsoft", "apple", "yahoo", "password", "
|
|
52
|
+
// "microsoft", "apple", "yahoo", "password", "emailLink"
|
|
53
53
|
// If not specified, all enabled providers in Firebase will be available
|
|
54
54
|
providers: ["google", "github", "password"],
|
|
55
55
|
// Optional: configure redirect URLs after authentication
|
|
@@ -2,79 +2,163 @@
|
|
|
2
2
|
title: Supabase Setup
|
|
3
3
|
sidebar_label: Supabase
|
|
4
4
|
description:
|
|
5
|
-
Learn how to set up Supabase authentication for
|
|
6
|
-
|
|
5
|
+
Learn how to set up Supabase authentication for Dev Portal using email and password or OAuth providers
|
|
6
|
+
for secure documentation access.
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
Supabase is an open-source Firebase alternative that provides authentication, database, and storage
|
|
10
10
|
services. This guide shows you how to integrate Supabase authentication with your Dev Portal documentation site.
|
|
11
11
|
|
|
12
|
+
You can use **email and password** (Supabase signs users in with an email address and password),
|
|
13
|
+
**OAuth providers** (GitHub, Google, and so on), or both. Follow the section that matches how you
|
|
14
|
+
want users to sign in.
|
|
15
|
+
|
|
12
16
|
## Prerequisites
|
|
13
17
|
|
|
14
18
|
You'll need a Supabase project. If you don't have one,
|
|
15
19
|
[create a free Supabase project](https://supabase.com/dashboard) to get started.
|
|
16
20
|
|
|
17
|
-
## Setup Steps
|
|
21
|
+
## Setup Steps for Email and Password
|
|
22
|
+
|
|
23
|
+
Use this path when users should sign up and sign in with an email address and password managed by
|
|
24
|
+
Supabase.
|
|
18
25
|
|
|
19
26
|
<Stepper>
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
<a id="configure-email-sign-in"></a>
|
|
29
|
+
|
|
30
|
+
1. **Enable email authentication in Supabase**
|
|
22
31
|
|
|
23
32
|
In your [Supabase Dashboard](https://supabase.com/dashboard):
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
- Select the project you are going to use
|
|
34
|
+
- Go to **Authentication** → **Configuration** → **Sign In / Providers**
|
|
35
|
+
- Under **Email**, ensure **Email sign-in** is enabled
|
|
36
|
+
- Decide whether new users must confirm their email before signing in (see **Confirm email** in
|
|
37
|
+
the same area). If confirmation is required, Supabase sends a link that returns users to your
|
|
38
|
+
Dev Portal portal (see [Authentication Routes](#authentication-routes))
|
|
29
39
|
|
|
30
|
-
2. **
|
|
40
|
+
2. **Copy your Supabase URL and publishable key**
|
|
31
41
|
|
|
32
42
|
From your Supabase project dashboard:
|
|
33
|
-
- Go to **Settings** → **Data API**
|
|
34
|
-
- Copy your **
|
|
35
|
-
- Go to **
|
|
36
|
-
- Copy your **
|
|
43
|
+
- Go to **Project Settings** → **Integrations** → **Data API**
|
|
44
|
+
- Copy your **API URL** (looks like `https://your-project-id.supabase.co`)
|
|
45
|
+
- Go to **Configuration** → **API Keys**
|
|
46
|
+
- Copy your **publishable** key (looks like `sb_publishable_...`)
|
|
37
47
|
|
|
38
48
|
3. **Configure Zudoku**
|
|
39
49
|
|
|
40
|
-
Add the
|
|
50
|
+
Add the following to your [Dev Portal configuration file](./overview.md). Omit `providers` or set it
|
|
51
|
+
to an empty array when you are only using email and password:
|
|
41
52
|
|
|
42
53
|
```ts title="zudoku.config.ts"
|
|
43
54
|
export default {
|
|
44
55
|
// ... other configuration
|
|
45
56
|
authentication: {
|
|
46
57
|
type: "supabase",
|
|
47
|
-
providers: [
|
|
58
|
+
providers: [],
|
|
48
59
|
supabaseUrl: "https://your-project.supabase.co",
|
|
49
|
-
supabaseKey: "<your-
|
|
60
|
+
supabaseKey: "<your-publishable-key>",
|
|
50
61
|
},
|
|
51
62
|
// ... other configuration
|
|
52
63
|
};
|
|
53
64
|
```
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
4. **Install Supabase dependencies**
|
|
67
|
+
|
|
68
|
+
Install the packages Dev Portal expects for the Supabase client and auth UI:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install @supabase/supabase-js
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
5. **Configure redirect URLs in Supabase**
|
|
75
|
+
|
|
76
|
+
Supabase only redirects to URLs you allow. This matters for **email confirmation**, **password
|
|
77
|
+
reset**, and **magic links** (if you use them elsewhere).
|
|
78
|
+
|
|
79
|
+
From your Supabase project dashboard, go to **Authentication** → **Configuration** → **URL
|
|
80
|
+
Configuration** and set:
|
|
81
|
+
- **Site URL**: Your primary deployed URL (for example `https://docs.example.com`), or
|
|
82
|
+
`http://localhost:3000` while developing locally.
|
|
83
|
+
- **Redirect URLs**: Include every origin where your docs run, with a path wildcard so deep links
|
|
84
|
+
work, for example:
|
|
85
|
+
- Production: `https://docs.example.com/**`
|
|
86
|
+
- Local dev: `http://localhost:3000/**`
|
|
87
|
+
|
|
88
|
+
Use the same origins and [base path](./overview.md) you use in the browser.
|
|
89
|
+
|
|
90
|
+
</Stepper>
|
|
91
|
+
|
|
92
|
+
## Setup Steps for Authentication Providers
|
|
93
|
+
|
|
94
|
+
Use this path when users should sign in with OAuth (for example GitHub or Google). Set
|
|
95
|
+
`onlyThirdPartyProviders: true` if you do not want email and password fields on the sign-in and
|
|
96
|
+
sign-up pages.
|
|
97
|
+
|
|
98
|
+
<Stepper>
|
|
99
|
+
|
|
100
|
+
<a id="configure-authentication-provider"></a>
|
|
101
|
+
|
|
102
|
+
1. **Configure Authentication Provider**
|
|
103
|
+
|
|
104
|
+
In your [Supabase Dashboard](https://supabase.com/dashboard):
|
|
105
|
+
- Select the Supabase project you are going to use
|
|
106
|
+
- Navigate to **Authentication** → **Configuration** → **Sign In / Providers**
|
|
107
|
+
- Enable your preferred authentication provider (GitHub, Google, Azure, etc.)
|
|
108
|
+
- Follow the Supabase configuration documentation for that provider
|
|
109
|
+
|
|
110
|
+
2. **Copy your Supabase URL and publishable key**
|
|
111
|
+
|
|
112
|
+
From your Supabase project dashboard:
|
|
113
|
+
- Go to **Project Settings** → **Integrations** → **Data API**
|
|
114
|
+
- Copy your **API URL** (looks like `https://your-project-id.supabase.co`)
|
|
115
|
+
- Go to **Configuration** → **API Keys**
|
|
116
|
+
- Copy your **publishable** key (looks like `sb_publishable_...`)
|
|
117
|
+
|
|
118
|
+
3. **Configure Zudoku**
|
|
119
|
+
|
|
120
|
+
Add the following to your [Dev Portal configuration file](./overview.md), using the API URL and
|
|
121
|
+
publishable key from the previous step. Include every OAuth provider you enabled in Supabase in
|
|
122
|
+
the `providers` array (see [Supported Providers](#supported-providers)):
|
|
56
123
|
|
|
57
124
|
```ts title="zudoku.config.ts"
|
|
58
125
|
export default {
|
|
59
126
|
// ... other configuration
|
|
60
127
|
authentication: {
|
|
61
128
|
type: "supabase",
|
|
62
|
-
providers: ["github",
|
|
129
|
+
providers: ["github"], // one or more providers — required for OAuth sign-in
|
|
63
130
|
supabaseUrl: "https://your-project.supabase.co",
|
|
64
|
-
supabaseKey: "<your-
|
|
131
|
+
supabaseKey: "<your-publishable-key>",
|
|
65
132
|
},
|
|
66
133
|
// ... other configuration
|
|
67
134
|
};
|
|
68
135
|
```
|
|
69
136
|
|
|
70
|
-
4. **Install Supabase
|
|
137
|
+
4. **Install Supabase dependencies**
|
|
71
138
|
|
|
72
|
-
|
|
139
|
+
Install the Supabase client and auth UI packages your Dev Portal project expects:
|
|
73
140
|
|
|
74
141
|
```bash
|
|
75
|
-
npm install @supabase/supabase-js
|
|
142
|
+
npm install @supabase/supabase-js
|
|
76
143
|
```
|
|
77
144
|
|
|
145
|
+
5. **Configure redirect URLs in Supabase**
|
|
146
|
+
|
|
147
|
+
Supabase only redirects back to URLs you allow. Add every environment where users sign in:
|
|
148
|
+
|
|
149
|
+
From your Supabase project dashboard, go to **Authentication** → **Configuration** → **URL
|
|
150
|
+
Configuration** and update:
|
|
151
|
+
- **Site URL**: Your primary deployed URL (for example `https://docs.example.com`), or
|
|
152
|
+
`http://localhost:3000` while developing locally.
|
|
153
|
+
- **Redirect URLs**: Include your Dev Portal site origin(s), for example:
|
|
154
|
+
- Production: `https://docs.example.com/**`
|
|
155
|
+
- Local dev: `http://localhost:3000/**`
|
|
156
|
+
- Preview deployments: a pattern your host uses, such as `https://*.vercel.app/**`, if
|
|
157
|
+
applicable.
|
|
158
|
+
|
|
159
|
+
Use the same paths you use in the browser (including any [base path](./overview.md) prefix). If
|
|
160
|
+
OAuth redirects fail or send users to the wrong host, this section is usually the cause.
|
|
161
|
+
|
|
78
162
|
</Stepper>
|
|
79
163
|
|
|
80
164
|
## Supported Providers
|
|
@@ -103,13 +187,43 @@ array:
|
|
|
103
187
|
- `zoom` - Zoom
|
|
104
188
|
- `fly` - Fly.io
|
|
105
189
|
|
|
106
|
-
|
|
190
|
+
## Email and Password with OAuth
|
|
191
|
+
|
|
192
|
+
To offer **both** email/password and OAuth buttons, leave `onlyThirdPartyProviders` unset (or set it
|
|
193
|
+
to `false`) and list your OAuth providers in `providers`. Complete
|
|
194
|
+
[Enable email authentication in Supabase](#configure-email-sign-in) and
|
|
195
|
+
[Configure Authentication Provider](#configure-authentication-provider) as needed, then use a config
|
|
196
|
+
similar to:
|
|
197
|
+
|
|
198
|
+
```ts title="zudoku.config.ts"
|
|
199
|
+
export default {
|
|
200
|
+
authentication: {
|
|
201
|
+
type: "supabase",
|
|
202
|
+
providers: ["github", "google"],
|
|
203
|
+
supabaseUrl: "https://your-project.supabase.co",
|
|
204
|
+
supabaseKey: "<your-publishable-key>",
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Configuring Multiple Providers
|
|
107
210
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
`onlyThirdPartyProviders: true` in your configuration.
|
|
211
|
+
Complete [Configure Authentication Provider](#configure-authentication-provider) in the Supabase
|
|
212
|
+
dashboard for each provider you need, then list them in the `providers` array:
|
|
111
213
|
|
|
112
|
-
|
|
214
|
+
```ts title="zudoku.config.ts"
|
|
215
|
+
export default {
|
|
216
|
+
// ... other configuration
|
|
217
|
+
authentication: {
|
|
218
|
+
type: "supabase",
|
|
219
|
+
onlyThirdPartyProviders: true,
|
|
220
|
+
providers: ["github", "google", "azure"],
|
|
221
|
+
supabaseUrl: "https://your-project.supabase.co",
|
|
222
|
+
supabaseKey: "<your-publishable-key>",
|
|
223
|
+
},
|
|
224
|
+
// ... other configuration
|
|
225
|
+
};
|
|
226
|
+
```
|
|
113
227
|
|
|
114
228
|
## Configuration Options
|
|
115
229
|
|
|
@@ -119,18 +233,18 @@ All available configuration options for Supabase authentication:
|
|
|
119
233
|
authentication: {
|
|
120
234
|
type: "supabase",
|
|
121
235
|
|
|
122
|
-
//
|
|
123
|
-
//
|
|
236
|
+
// OAuth providers to show as buttons (optional for email/password-only; required for OAuth)
|
|
237
|
+
// See Supported Providers — values must match Supabase provider IDs
|
|
124
238
|
providers: ["google", "github"],
|
|
125
239
|
|
|
126
240
|
// Supabase credentials (required)
|
|
127
241
|
supabaseUrl: "https://your-project.supabase.co",
|
|
128
|
-
supabaseKey: "<your-
|
|
242
|
+
supabaseKey: "<your-publishable-key>",
|
|
129
243
|
|
|
130
244
|
// Optional: Custom base path for auth routes (default: "/")
|
|
131
245
|
basePath: "/docs",
|
|
132
246
|
|
|
133
|
-
// Optional:
|
|
247
|
+
// Optional: When true, sign-in and sign-up pages show only OAuth buttons (no email/password)
|
|
134
248
|
onlyThirdPartyProviders: true,
|
|
135
249
|
|
|
136
250
|
// Optional: Redirect URLs after authentication events
|
|
@@ -144,9 +258,9 @@ authentication: {
|
|
|
144
258
|
|
|
145
259
|
The Supabase authentication provider automatically creates the following routes:
|
|
146
260
|
|
|
147
|
-
- `/signin` - Sign in
|
|
148
|
-
- `/signup` - Sign up
|
|
149
|
-
- `/signout` - Sign out
|
|
261
|
+
- `/signin` - Sign in (email and password when enabled, plus any configured OAuth providers)
|
|
262
|
+
- `/signup` - Sign up (same as sign-in)
|
|
263
|
+
- `/signout` - Sign out
|
|
150
264
|
|
|
151
265
|
If you configure a custom `basePath`, these routes will be prefixed with that path (e.g.,
|
|
152
266
|
`/docs/signin`).
|
|
@@ -201,23 +315,30 @@ CREATE TRIGGER on_auth_user_created
|
|
|
201
315
|
|
|
202
316
|
### Common Issues
|
|
203
317
|
|
|
204
|
-
1. **
|
|
205
|
-
|
|
318
|
+
1. **OAuth sign-in shows no provider buttons**: For OAuth-only setups, add at least one provider ID
|
|
319
|
+
to the `providers` array that matches a provider you enabled in Supabase. For **email and
|
|
320
|
+
password only**, you can use `providers: []` — see
|
|
321
|
+
[Setup Steps for Email and Password](#setup-steps-for-email-and-password).
|
|
322
|
+
|
|
323
|
+
2. **Email/password fields when you want OAuth only**: Set `onlyThirdPartyProviders: true` so the
|
|
324
|
+
sign-in and sign-up screens show only OAuth buttons. Leave this unset (or `false`) when you want
|
|
325
|
+
email and password fields — see
|
|
326
|
+
[Setup Steps for Email and Password](#setup-steps-for-email-and-password).
|
|
206
327
|
|
|
207
|
-
|
|
208
|
-
|
|
328
|
+
3. **Invalid API key**: Use the **publishable** client key in `supabaseKey`, not the **secret**
|
|
329
|
+
(service role) key.
|
|
209
330
|
|
|
210
|
-
|
|
331
|
+
4. **Provider Not Working**: Verify the provider is enabled in your Supabase dashboard and properly
|
|
211
332
|
configured with the correct redirect URLs.
|
|
212
333
|
|
|
213
|
-
|
|
334
|
+
5. **Redirect URLs**: For local development, update your redirect URLs in both Supabase and the
|
|
214
335
|
OAuth provider to include `http://localhost:3000`.
|
|
215
336
|
|
|
216
|
-
|
|
337
|
+
6. **CORS Errors**: Check that your site's domain is properly configured in Supabase's allowed URLs
|
|
217
338
|
under **Authentication** → **URL Configuration**.
|
|
218
339
|
|
|
219
|
-
|
|
220
|
-
|
|
340
|
+
7. **Authentication Not Working**: Make sure you have installed `@supabase/supabase-js` in your
|
|
341
|
+
project dependencies.
|
|
221
342
|
|
|
222
343
|
## Next Steps
|
|
223
344
|
|
|
@@ -117,7 +117,7 @@ the Firebase console under Project Settings.
|
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
The `providers` option configures which sign-in methods are available. Supported providers include:
|
|
120
|
-
`google`, `facebook`, `twitter`, `github`, `microsoft`, `apple`, `yahoo`, `password`,
|
|
120
|
+
`google`, `facebook`, `twitter`, `github`, `microsoft`, `apple`, `yahoo`, `password`, and
|
|
121
121
|
`emailLink`.
|
|
122
122
|
|
|
123
123
|
For detailed setup instructions, see the [Firebase setup guide](./authentication-firebase.md).
|
|
@@ -125,14 +125,14 @@ For detailed setup instructions, see the [Firebase setup guide](./authentication
|
|
|
125
125
|
### Supabase
|
|
126
126
|
|
|
127
127
|
To use Supabase as your authentication provider, supply your project's URL, API key, and the OAuth
|
|
128
|
-
|
|
128
|
+
providers to use.
|
|
129
129
|
|
|
130
130
|
```typescript title="zudoku.config.ts"
|
|
131
131
|
{
|
|
132
132
|
// ...
|
|
133
133
|
authentication: {
|
|
134
134
|
type: "supabase",
|
|
135
|
-
|
|
135
|
+
providers: ["github"],
|
|
136
136
|
supabaseUrl: "https://your-project.supabase.co",
|
|
137
137
|
supabaseKey: "<your-supabase-key>",
|
|
138
138
|
redirectToAfterSignUp: "/",
|
|
@@ -143,10 +143,10 @@ provider to use.
|
|
|
143
143
|
}
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
The `
|
|
147
|
-
`bitbucket`, `discord`, `facebook`, `figma`, `github`, `gitlab`, `google`, `kakao`,
|
|
148
|
-
`linkedin`, `linkedin_oidc`, `notion`, `slack`, `slack_oidc`, `spotify`, `twitch`,
|
|
149
|
-
`workos`, `zoom`, or `fly`.
|
|
146
|
+
The `providers` option accepts an array of Supabase Auth's supported providers, such as `apple`,
|
|
147
|
+
`azure`, `bitbucket`, `discord`, `facebook`, `figma`, `github`, `gitlab`, `google`, `kakao`,
|
|
148
|
+
`keycloak`, `linkedin`, `linkedin_oidc`, `notion`, `slack`, `slack_oidc`, `spotify`, `twitch`,
|
|
149
|
+
`twitter`, `workos`, `zoom`, or `fly`.
|
|
150
150
|
|
|
151
151
|
### Azure B2C
|
|
152
152
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: OAuth Security Schemes
|
|
3
|
+
sidebar_icon: shield
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
If your OpenAPI specification defines OAuth2 or OpenID Connect security schemes, Dev Portal will display
|
|
7
|
+
them as informational badges on your API operations. However, interactive OAuth flows (such as
|
|
8
|
+
Authorization Code or Client Credentials) are **not active by default** in the playground. To enable
|
|
9
|
+
OAuth-based authentication for API requests, you need to configure a Dev Portal [authentication provider](./authentication.md).
|
|
10
|
+
|
|
11
|
+
## Why Dev Portal Uses Its Own Authentication System
|
|
12
|
+
|
|
13
|
+
OpenAPI `securitySchemes` describe _what_ authentication an API requires, but they don't include the
|
|
14
|
+
runtime configuration needed to actually perform an OAuth flow — such as the client ID, client
|
|
15
|
+
secret, redirect URI, or provider-specific settings.
|
|
16
|
+
|
|
17
|
+
Rather than attempting to derive a working OAuth flow from incomplete spec metadata, Dev Portal gives
|
|
18
|
+
you full control through its authentication plugin system. This approach:
|
|
19
|
+
|
|
20
|
+
- Works reliably across OAuth providers (Auth0, Azure B2C, Okta, Keycloak, etc.) without
|
|
21
|
+
provider-specific workarounds
|
|
22
|
+
- Avoids exposing client secrets in the browser
|
|
23
|
+
- Handles token refresh, session management, and logout correctly
|
|
24
|
+
- Integrates with Zudoku's [protected routes](./protected-routes.md) and
|
|
25
|
+
[API identity](../concepts/auth-provider-api-identities.md) system
|
|
26
|
+
|
|
27
|
+
## Setting Up OAuth for the Playground
|
|
28
|
+
|
|
29
|
+
To enable OAuth-based authentication in the API playground, follow these two steps:
|
|
30
|
+
|
|
31
|
+
### 1. Configure an Authentication Provider
|
|
32
|
+
|
|
33
|
+
Add an `authentication` block to your `zudoku.config.ts`. This handles the OAuth flow (redirects,
|
|
34
|
+
token exchange, session management) for your documentation portal.
|
|
35
|
+
|
|
36
|
+
For example, using Auth0:
|
|
37
|
+
|
|
38
|
+
```ts title=zudoku.config.ts
|
|
39
|
+
const config = {
|
|
40
|
+
authentication: {
|
|
41
|
+
type: "auth0",
|
|
42
|
+
domain: "yourdomain.us.auth0.com",
|
|
43
|
+
clientId: "<your-auth0-client-id>",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or using any OpenID Connect provider:
|
|
49
|
+
|
|
50
|
+
```ts title=zudoku.config.ts
|
|
51
|
+
const config = {
|
|
52
|
+
authentication: {
|
|
53
|
+
type: "openid",
|
|
54
|
+
clientId: "<your-client-id>",
|
|
55
|
+
issuer: "https://your-idp.example.com",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See [Authentication](./authentication.md) for the full list of supported providers.
|
|
61
|
+
|
|
62
|
+
### 2. Create an API Identity Plugin
|
|
63
|
+
|
|
64
|
+
The authentication provider signs users into the portal. To use their token for API requests in the
|
|
65
|
+
playground, create an [API Identity plugin](../concepts/auth-provider-api-identities.md) that
|
|
66
|
+
bridges the two:
|
|
67
|
+
|
|
68
|
+
```ts title=zudoku.config.ts
|
|
69
|
+
import { createApiIdentityPlugin } from "zudoku/plugins";
|
|
70
|
+
|
|
71
|
+
const config = {
|
|
72
|
+
authentication: {
|
|
73
|
+
type: "openid",
|
|
74
|
+
clientId: "<your-client-id>",
|
|
75
|
+
issuer: "https://your-idp.example.com",
|
|
76
|
+
},
|
|
77
|
+
plugins: [
|
|
78
|
+
createApiIdentityPlugin({
|
|
79
|
+
getIdentities: async (context) => [
|
|
80
|
+
{
|
|
81
|
+
id: "oauth-token",
|
|
82
|
+
label: "OAuth Token",
|
|
83
|
+
authorizeRequest: (request) => {
|
|
84
|
+
return context.authentication?.signRequest(request);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Once configured, users can sign in to your documentation portal and their OAuth token will be
|
|
94
|
+
automatically attached to API requests made from the playground.
|
|
95
|
+
|
|
96
|
+
## What About Non-OAuth Security Schemes?
|
|
97
|
+
|
|
98
|
+
Simple security schemes like API keys and HTTP bearer tokens defined in your OpenAPI spec work in
|
|
99
|
+
the playground without any additional Dev Portal configuration. Users can enter their credentials
|
|
100
|
+
directly in the playground's Authorize dialog.
|
|
101
|
+
|
|
102
|
+
OAuth2 and OpenID Connect schemes are the exception — they require the authentication provider
|
|
103
|
+
configuration described above because performing OAuth flows requires runtime configuration that
|
|
104
|
+
goes beyond what OpenAPI specifies.
|
|
105
|
+
|
|
106
|
+
## Disabling Security Scheme Display
|
|
107
|
+
|
|
108
|
+
If you don't want security scheme information displayed at all (badges on operations, the security
|
|
109
|
+
schemes section on the info page, and the Authorize dialog), you can disable it:
|
|
110
|
+
|
|
111
|
+
```ts title=zudoku.config.ts
|
|
112
|
+
const config = {
|
|
113
|
+
apis: {
|
|
114
|
+
type: "file",
|
|
115
|
+
input: "./openapi.json",
|
|
116
|
+
path: "/api",
|
|
117
|
+
options: {
|
|
118
|
+
disableSecurity: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
```
|
|
@@ -87,6 +87,44 @@ Set the text direction for your site. This is useful for right-to-left languages
|
|
|
87
87
|
We allow you to fully customize all colors, borders, etc - read more about it in
|
|
88
88
|
[Colors & Themes](/dev-portal/zudoku/customization/colors-theme)
|
|
89
89
|
|
|
90
|
+
#### Custom 404 Page
|
|
91
|
+
|
|
92
|
+
Replace the default "Page not found" page with your own component using the `notFoundPage` option:
|
|
93
|
+
|
|
94
|
+
```tsx title=zudoku.config.tsx
|
|
95
|
+
import { NotFound } from "./src/NotFound";
|
|
96
|
+
|
|
97
|
+
const config = {
|
|
98
|
+
site: {
|
|
99
|
+
notFoundPage: <NotFound />,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Your component will be rendered whenever a user navigates to a route that doesn't exist. This works
|
|
105
|
+
in both development and production builds.
|
|
106
|
+
|
|
107
|
+
Here's an example of a custom 404 component:
|
|
108
|
+
|
|
109
|
+
```tsx title=src/NotFound.tsx
|
|
110
|
+
import { Button, Link } from "zudoku/components";
|
|
111
|
+
|
|
112
|
+
export const NotFound = () => (
|
|
113
|
+
<section className="flex items-center justify-center py-20">
|
|
114
|
+
<div className="text-center max-w-lg mx-auto">
|
|
115
|
+
<p className="text-6xl font-extrabold text-primary mb-4">404</p>
|
|
116
|
+
<h1 className="text-3xl font-bold mb-4">Page not found</h1>
|
|
117
|
+
<p className="text-muted-foreground mb-8">
|
|
118
|
+
The page you're looking for doesn't exist or has been moved.
|
|
119
|
+
</p>
|
|
120
|
+
<Button asChild>
|
|
121
|
+
<Link to="/">Go back home</Link>
|
|
122
|
+
</Button>
|
|
123
|
+
</div>
|
|
124
|
+
</section>
|
|
125
|
+
);
|
|
126
|
+
```
|
|
127
|
+
|
|
90
128
|
## Layout
|
|
91
129
|
|
|
92
130
|
### Banner
|
|
@@ -126,6 +164,7 @@ Here's a comprehensive example showing all available page configuration options:
|
|
|
126
164
|
alt: "Company Logo",
|
|
127
165
|
width: "100px",
|
|
128
166
|
},
|
|
167
|
+
notFoundPage: <NotFound />,
|
|
129
168
|
banner: {
|
|
130
169
|
message: "Welcome to our documentation!",
|
|
131
170
|
color: "info",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zuplo",
|
|
3
|
-
"version": "6.68.
|
|
3
|
+
"version": "6.68.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The programmable API Gateway",
|
|
6
6
|
"author": "Zuplo, Inc.",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"zuplo": "zuplo.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@zuplo/cli": "6.68.
|
|
23
|
-
"@zuplo/core": "6.68.
|
|
24
|
-
"@zuplo/runtime": "6.68.
|
|
22
|
+
"@zuplo/cli": "6.68.16",
|
|
23
|
+
"@zuplo/core": "6.68.16",
|
|
24
|
+
"@zuplo/runtime": "6.68.16",
|
|
25
25
|
"@zuplo/test": "1.4.0"
|
|
26
26
|
}
|
|
27
27
|
}
|