From 6f4f54708e328c40485f27537471b86d8580f799 Mon Sep 17 00:00:00 2001 From: Mridang Agarwalla Date: Mon, 9 Feb 2026 18:40:21 +1100 Subject: [PATCH] docs: fix callback URLs in SDK examples to match auth-library behavior (#11526) --- apps/docs/content/sdk-examples/astro.mdx | 14 +++++++------- apps/docs/content/sdk-examples/expressjs.mdx | 6 +++--- apps/docs/content/sdk-examples/fastify.mdx | 6 +++--- apps/docs/content/sdk-examples/hono.mdx | 6 +++--- apps/docs/content/sdk-examples/nestjs.mdx | 4 ++-- apps/docs/content/sdk-examples/solidstart.mdx | 4 ++-- apps/docs/content/sdk-examples/sveltekit.mdx | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/apps/docs/content/sdk-examples/astro.mdx b/apps/docs/content/sdk-examples/astro.mdx index 4012aa72c..c0be2cc9f 100644 --- a/apps/docs/content/sdk-examples/astro.mdx +++ b/apps/docs/content/sdk-examples/astro.mdx @@ -37,8 +37,8 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:4321/api/auth/callback` for development) -4. Configure post-logout redirect URIs (e.g., `http://localhost:4321/api/auth/logout/callback`) +3. Set up your redirect URIs (e.g., `http://localhost:3000/api/auth/callback/zitadel` for development) +4. Configure post-logout redirect URIs (e.g., `http://localhost:3000/api/auth/logout/callback`) 5. Copy your **Client ID** from the application details > **Note:** Make sure to enable **Dev Mode** in the [ZITADEL Management Console](https://zitadel.com/docs/guides/manage/console/overview) if you're using HTTP URLs during local development. For production deployments, always use HTTPS URLs and disable Dev Mode. @@ -50,16 +50,16 @@ Once you have your [Zitadel application configured](https://zitadel.com/docs/gui 1. Clone the [repository](https://github.com/zitadel/example-auth-astro). 2. Create a `.env` file based on `.env.example` and configure it with the values from your [Zitadel application](https://zitadel.com/docs/guides/manage/console/applications). Use these environment variable names exactly as shown: ``` - PORT=4321 + PORT=3000 SESSION_DURATION=3600 SESSION_SECRET=your-very-secret-and-strong-session-key ZITADEL_DOMAIN=https://your-zitadel-instance.zitadel.cloud ZITADEL_CLIENT_ID=your_client_id_from_console ZITADEL_CLIENT_SECRET=your-randomly-generated-client-secret - ZITADEL_CALLBACK_URL=http://localhost:4321/auth/callback - ZITADEL_POST_LOGOUT_URL=http://localhost:4321/api/auth/logout/callback + ZITADEL_CALLBACK_URL=http://localhost:3000/api/auth/callback/zitadel + ZITADEL_POST_LOGOUT_URL=http://localhost:3000/api/auth/logout/callback AUTH_TRUST_HOST=true - NEXTAUTH_URL=http://localhost:4321 + NEXTAUTH_URL=http://localhost:3000 ``` Replace these values with: - Your actual [Zitadel instance URL](https://zitadel.com/docs/guides/manage/console/default-settings) (the **ZITADEL_DOMAIN**) @@ -67,7 +67,7 @@ Once you have your [Zitadel application configured](https://zitadel.com/docs/gui - A randomly generated **SESSION_SECRET** using: `node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"` - A randomly generated **ZITADEL_CLIENT_SECRET** (required by Auth.js even though PKCE doesn't require it) - The **redirect URIs** you configured in the PKCE setup (must match exactly) -3. Install dependencies using [npm](https://www.npmjs.com) by running `npm install`, then start the development server with `npm run dev` to verify the authentication flow end-to-end at `http://localhost:4321`. +3. Install dependencies using [npm](https://www.npmjs.com) by running `npm install`, then start the development server with `npm run dev` to verify the authentication flow end-to-end at `http://localhost:3000`. --- diff --git a/apps/docs/content/sdk-examples/expressjs.mdx b/apps/docs/content/sdk-examples/expressjs.mdx index afe5114f3..21874fbdd 100644 --- a/apps/docs/content/sdk-examples/expressjs.mdx +++ b/apps/docs/content/sdk-examples/expressjs.mdx @@ -37,7 +37,7 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback` for development) +3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback/zitadel` for development) 4. Configure post-logout redirect URIs (e.g., `http://localhost:3000/auth/logout/callback`) 5. Copy your **Client ID** for use in the next steps @@ -57,9 +57,9 @@ Once you have your [Zitadel application configured](https://zitadel.com/docs/gui ZITADEL_DOMAIN=https://your-instance.zitadel.cloud ZITADEL_CLIENT_ID=your_client_id_from_console ZITADEL_CLIENT_SECRET=your-randomly-generated-client-secret - ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback + ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback/zitadel ZITADEL_POST_LOGIN_URL=/profile - ZITADEL_POST_LOGOUT_URL=http://localhost:3000 + ZITADEL_POST_LOGOUT_URL=http://localhost:3000/auth/logout/callback ``` Replace these values with: - Your actual Zitadel instance URL (the **Issuer** from the PKCE setup guide) diff --git a/apps/docs/content/sdk-examples/fastify.mdx b/apps/docs/content/sdk-examples/fastify.mdx index e93e869cc..8b3677a04 100644 --- a/apps/docs/content/sdk-examples/fastify.mdx +++ b/apps/docs/content/sdk-examples/fastify.mdx @@ -37,7 +37,7 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback` for development) +3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback/zitadel` for development) 4. Configure post-logout redirect URIs (e.g., `http://localhost:3000`) 5. Copy your **Client ID** for use in the next steps 6. Optionally enable [refresh tokens](https://zitadel.com/docs/apis/openidoauth/grant-types#refresh-token) in Token Settings for long-lived sessions @@ -58,9 +58,9 @@ Once you have your [Zitadel application](https://zitadel.com/docs/guides/manage/ ZITADEL_DOMAIN=https://your-zitadel-domain ZITADEL_CLIENT_ID=your-zitadel-application-client-id ZITADEL_CLIENT_SECRET= - ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback + ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback/zitadel ZITADEL_POST_LOGIN_URL=/profile - ZITADEL_POST_LOGOUT_URL=http://localhost:3000 + ZITADEL_POST_LOGOUT_URL=http://localhost:3000/auth/logout/callback ``` Replace these values with: - Your actual [Zitadel instance URL](https://zitadel.com/docs/guides/manage/console/default-settings) for `ZITADEL_DOMAIN` (the issuer) diff --git a/apps/docs/content/sdk-examples/hono.mdx b/apps/docs/content/sdk-examples/hono.mdx index 4e707861b..cb6d5b011 100644 --- a/apps/docs/content/sdk-examples/hono.mdx +++ b/apps/docs/content/sdk-examples/hono.mdx @@ -35,7 +35,7 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback` for development) +3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback/zitadel` for development) 4. Configure post-logout redirect URIs (e.g., `http://localhost:3000/auth/logout/callback`) 5. Copy your **Client ID** for use in the next steps @@ -55,9 +55,9 @@ Once you have your Zitadel application configured: ZITADEL_DOMAIN=https://your-instance.zitadel.cloud ZITADEL_CLIENT_ID=your_client_id_from_console ZITADEL_CLIENT_SECRET= - ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback + ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback/zitadel ZITADEL_POST_LOGIN_URL=/profile - ZITADEL_POST_LOGOUT_URL=http://localhost:3000 + ZITADEL_POST_LOGOUT_URL=http://localhost:3000/auth/logout/callback ``` Replace these values with: - Your actual **Zitadel instance URL** (the Issuer from your [instance settings](https://zitadel.com/docs/guides/manage/console/default-settings)) diff --git a/apps/docs/content/sdk-examples/nestjs.mdx b/apps/docs/content/sdk-examples/nestjs.mdx index b38444575..27c6513fe 100644 --- a/apps/docs/content/sdk-examples/nestjs.mdx +++ b/apps/docs/content/sdk-examples/nestjs.mdx @@ -39,7 +39,7 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback` for development) +3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback/zitadel` for development) 4. Configure post-logout redirect URIs (e.g., `http://localhost:3000/auth/logout/callback`) 5. Copy your **Client ID** for use in the next steps @@ -62,7 +62,7 @@ Once you have your Zitadel application configured: ZITADEL_DOMAIN=https://your-instance.zitadel.cloud ZITADEL_CLIENT_ID=your_client_id_from_console ZITADEL_CLIENT_SECRET=your_randomly_generated_secret - ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback + ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback/zitadel ZITADEL_POST_LOGIN_URL=/profile ZITADEL_POST_LOGOUT_URL=http://localhost:3000/auth/logout/callback ``` diff --git a/apps/docs/content/sdk-examples/solidstart.mdx b/apps/docs/content/sdk-examples/solidstart.mdx index 19d43bf6a..39b32550c 100644 --- a/apps/docs/content/sdk-examples/solidstart.mdx +++ b/apps/docs/content/sdk-examples/solidstart.mdx @@ -35,7 +35,7 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback` for development) +3. Set up your redirect URIs (e.g., `http://localhost:3000/api/auth/callback/zitadel` for development) 4. Configure post-logout redirect URIs (e.g., `http://localhost:3000/api/auth/logout/callback`) 5. Copy your **Client ID** for use in the next steps @@ -55,7 +55,7 @@ Once you have your [Zitadel application](https://zitadel.com/docs/guides/manage/ ZITADEL_DOMAIN="https://your-zitadel-domain" ZITADEL_CLIENT_ID="your-client-id" ZITADEL_CLIENT_SECRET="your-randomly-generated-client-secret" - ZITADEL_CALLBACK_URL="http://localhost:3000/auth/callback" + ZITADEL_CALLBACK_URL="http://localhost:3000/api/auth/callback/zitadel" ZITADEL_POST_LOGIN_URL="/profile" ZITADEL_POST_LOGOUT_URL="http://localhost:3000/api/auth/logout/callback" NEXTAUTH_URL="http://localhost:3000" diff --git a/apps/docs/content/sdk-examples/sveltekit.mdx b/apps/docs/content/sdk-examples/sveltekit.mdx index 2a9d86cf1..4c6a7e8e0 100644 --- a/apps/docs/content/sdk-examples/sveltekit.mdx +++ b/apps/docs/content/sdk-examples/sveltekit.mdx @@ -37,7 +37,7 @@ Before running this example, you need to create and configure a PKCE application 1. Create a new Web application in your [Zitadel project](https://zitadel.com/docs/guides/manage/console/projects) 2. Configure it to use the PKCE authentication method -3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback` for development) +3. Set up your redirect URIs (e.g., `http://localhost:3000/auth/callback/zitadel` for development) 4. Configure post-logout redirect URIs (e.g., `http://localhost:3000/auth/logout/callback`) 5. Copy your **Client ID** for use in the next steps @@ -55,7 +55,7 @@ Once you have your Zitadel application configured: ZITADEL_DOMAIN=https://your-instance.zitadel.cloud ZITADEL_CLIENT_ID=your_client_id_from_console ZITADEL_CLIENT_SECRET=your-randomly-generated-client-secret - ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback + ZITADEL_CALLBACK_URL=http://localhost:3000/auth/callback/zitadel ZITADEL_POST_LOGOUT_URL=http://localhost:3000/auth/logout/callback NEXTAUTH_URL=http://localhost:3000 ```