From 3c50b942e00b352db62826f030e3651a3fdc76fc Mon Sep 17 00:00:00 2001 From: Wassim Bougarfa <12980387+wassimoo@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:50:51 +0100 Subject: [PATCH 1/5] docs: Fix redirect callback URI in integration guide, and update ory.sh reference to ory.com --- docs/getting-started/integrate-auth/14_auth-js.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/getting-started/integrate-auth/14_auth-js.mdx b/docs/getting-started/integrate-auth/14_auth-js.mdx index e9f6ffca6..06c9f977f 100644 --- a/docs/getting-started/integrate-auth/14_auth-js.mdx +++ b/docs/getting-started/integrate-auth/14_auth-js.mdx @@ -63,7 +63,7 @@ To create the client using the Ory Console: 1. Sign in to your Ory Network account. 2. Create or select a project. -3. Go to **OAuth 2**, select [**OAuth2 Clients**](https://console.ory.sh/projects/current/oauth), and select [**Create OAuth 2.0 Client**](https://console.ory.sh/projects/current/oauth/create). +3. Go to **OAuth 2**, select [**OAuth2 Clients**](https://console.ory.com/projects/current/oauth), and select [**Create OAuth 2.0 Client**](https://console.ory.com/projects/current/oauth/create). 4. Select **Server App**. 5. Enter a client name, for example, "NextAuth / Auth.js Example." 6. Ensure the following scopes are selected: @@ -74,7 +74,7 @@ To create the client using the Ory Console: 7. Add the following to **Redirect URIs**: ``` - http://localhost:3000/api/auth/callback/ory + http://localhost:3000/auth/callback/ory ``` 8. Add the following to **Post Logout Redirect URIs**: @@ -94,7 +94,7 @@ To create the client using the Ory Console: To create the client using the Ory CLI, run the following command: ```shell -export ORY_PROJECT_ID= # Take this value from https://console.ory.sh/projects/current/get-started +export ORY_PROJECT_ID= # Take this value from https://console.ory.com/projects/current/get-started ory create oauth2-client --project $ORY_PROJECT_ID \ --redirect-uri http://localhost:3000/api/auth/callback/ory \ --name "NextAuth / Auth.js Example" \ @@ -115,8 +115,8 @@ Update your `.env.local` file to match the example: ``` -Also add your Ory SDK URL. You can find it in the [**Get started**](https://console.ory.sh/projects/current/get-started) section -of the Ory Console. +Also add your Ory SDK URL as `ORY_SDK_URL`. You can find it in the +[**Get started**](https://console.ory.com/projects/current/get-started) section of the Ory Console. ## Test your application From 467358d73d132cf5238cee18fb2e8138718389b4 Mon Sep 17 00:00:00 2001 From: Wassim Bougarfa <12980387+wassimoo@users.noreply.github.com> Date: Wed, 19 Nov 2025 18:06:15 +0100 Subject: [PATCH 2/5] docs: Add guidance for resolving UntrustedHost errors in Auth.js integration --- .../integrate-auth/14_auth-js.mdx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/integrate-auth/14_auth-js.mdx b/docs/getting-started/integrate-auth/14_auth-js.mdx index 06c9f977f..96bde7b41 100644 --- a/docs/getting-started/integrate-auth/14_auth-js.mdx +++ b/docs/getting-started/integrate-auth/14_auth-js.mdx @@ -159,5 +159,21 @@ The request is missing a required parameter, includes an invalid parameter value The 'redirect_uri' parameter does not match any of the OAuth 2.0 Client's pre-registered redirect URLs. ``` -Make sure that the redirect URL exactly matches the one registered in Ory. Use the browser’s network tab to inspect requests made +Make sure that the redirect URL exactly matches the one registered in Ory. Use the browser's network tab to inspect requests made to `/oauth2/auth`. + +### Resolve UntrustedHost errors + +If you receive an error like: + +``` +[auth][error] UntrustedHost: Host must be trusted. URL was: http://localhost:3000/auth/signin?callbackUrl=... +``` + +Add the following to your `.env.local` file: + +``` +AUTH_TRUST_HOST=1 +``` + +This allows Auth.js to trust the localhost host during development. For production, make sure to configure trusted hosts properly. From 814ce16f0118724deacc58025d01930cc6fa9fa5 Mon Sep 17 00:00:00 2001 From: Wassim Bougarfa <12980387+wassimoo@users.noreply.github.com> Date: Thu, 20 Nov 2025 09:23:14 +0100 Subject: [PATCH 3/5] docs: revert console links in auth.js integration guide to use ory.sh --- docs/getting-started/integrate-auth/14_auth-js.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting-started/integrate-auth/14_auth-js.mdx b/docs/getting-started/integrate-auth/14_auth-js.mdx index 96bde7b41..816fafa7c 100644 --- a/docs/getting-started/integrate-auth/14_auth-js.mdx +++ b/docs/getting-started/integrate-auth/14_auth-js.mdx @@ -63,7 +63,7 @@ To create the client using the Ory Console: 1. Sign in to your Ory Network account. 2. Create or select a project. -3. Go to **OAuth 2**, select [**OAuth2 Clients**](https://console.ory.com/projects/current/oauth), and select [**Create OAuth 2.0 Client**](https://console.ory.com/projects/current/oauth/create). +3. Go to **OAuth 2**, select [**OAuth2 Clients**](https://console.ory.sh/projects/current/oauth), and select [**Create OAuth 2.0 Client**](https://console.ory.sh/projects/current/oauth/create). 4. Select **Server App**. 5. Enter a client name, for example, "NextAuth / Auth.js Example." 6. Ensure the following scopes are selected: @@ -94,7 +94,7 @@ To create the client using the Ory Console: To create the client using the Ory CLI, run the following command: ```shell -export ORY_PROJECT_ID= # Take this value from https://console.ory.com/projects/current/get-started +export ORY_PROJECT_ID= # Take this value from https://console.ory.sh/projects/current/get-started ory create oauth2-client --project $ORY_PROJECT_ID \ --redirect-uri http://localhost:3000/api/auth/callback/ory \ --name "NextAuth / Auth.js Example" \ @@ -116,7 +116,7 @@ Update your `.env.local` file to match the example: ``` Also add your Ory SDK URL as `ORY_SDK_URL`. You can find it in the -[**Get started**](https://console.ory.com/projects/current/get-started) section of the Ory Console. +[**Get started**](https://console.ory.sh/projects/current/get-started) section of the Ory Console. ## Test your application From fe3e381d0711c7d573a0dc719693f3ef3f16d4c7 Mon Sep 17 00:00:00 2001 From: Wassim Bougarfa <12980387+wassimoo@users.noreply.github.com> Date: Thu, 20 Nov 2025 09:38:28 +0100 Subject: [PATCH 4/5] docs: add configuration guide for production SDK URL --- .../_common/configure-production-sdk-url.mdx | 11 +++++++++++ docs/getting-started/integrate-auth/14_auth-js.mdx | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 docs/getting-started/_common/configure-production-sdk-url.mdx diff --git a/docs/getting-started/_common/configure-production-sdk-url.mdx b/docs/getting-started/_common/configure-production-sdk-url.mdx new file mode 100644 index 000000000..9e44caf71 --- /dev/null +++ b/docs/getting-started/_common/configure-production-sdk-url.mdx @@ -0,0 +1,11 @@ +### Configure your production SDK URL + +For production, configure `ORY_SDK_URL` to point to your Ory Network CNAME instead of the `oryapis.com` domain: + +```env +# Production configuration +ORY_SDK_URL=https://ory.your-domain.com +``` + +If you haven't set up a custom domain yet, [add a Custom Domain to your Ory Network project](../../guides/custom-domains.mdx). The CNAME becomes your project's SDK Configuration URL, which you can verify in the [project settings](https://console.ory.sh/projects/current/settings). + diff --git a/docs/getting-started/integrate-auth/14_auth-js.mdx b/docs/getting-started/integrate-auth/14_auth-js.mdx index 816fafa7c..e333c76b2 100644 --- a/docs/getting-started/integrate-auth/14_auth-js.mdx +++ b/docs/getting-started/integrate-auth/14_auth-js.mdx @@ -23,6 +23,7 @@ Follow these steps to integrate Ory: import CodeFromRemote from "@theme/CodeFromRemote" import Tabs from "@theme/Tabs" import TabItem from "@theme/TabItem" +import ConfigureProductionSdkUrl from '../_common/configure-production-sdk-url.mdx' ``` ## Clone Next.js app @@ -148,6 +149,10 @@ import ToProd from '../_common/going-to-prod.mdx' ``` +```mdx-code-block + +``` + ## Troubleshoot common integration errors ### Resolve redirect URL mismatch errors From 09ff21d1d2d4662f298b04ade8334792bc2f2734 Mon Sep 17 00:00:00 2001 From: Wassim Bougarfa <12980387+wassimoo@users.noreply.github.com> Date: Thu, 20 Nov 2025 09:44:47 +0100 Subject: [PATCH 5/5] docs: fix formatting in production SDK URL configuration guide --- .../getting-started/_common/configure-production-sdk-url.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/_common/configure-production-sdk-url.mdx b/docs/getting-started/_common/configure-production-sdk-url.mdx index 9e44caf71..4468c20e2 100644 --- a/docs/getting-started/_common/configure-production-sdk-url.mdx +++ b/docs/getting-started/_common/configure-production-sdk-url.mdx @@ -7,5 +7,6 @@ For production, configure `ORY_SDK_URL` to point to your Ory Network CNAME inste ORY_SDK_URL=https://ory.your-domain.com ``` -If you haven't set up a custom domain yet, [add a Custom Domain to your Ory Network project](../../guides/custom-domains.mdx). The CNAME becomes your project's SDK Configuration URL, which you can verify in the [project settings](https://console.ory.sh/projects/current/settings). - +If you haven't set up a custom domain yet, [add a Custom Domain to your Ory Network project](../../guides/custom-domains.mdx). The +CNAME becomes your project's SDK Configuration URL, which you can verify in the +[project settings](https://console.ory.sh/projects/current/settings).