billions-minister-2901
02/26/2024, 5:37 PMchilly-king-10285
02/26/2024, 5:37 PMchilly-king-10285
02/26/2024, 5:38 PMSet-Cookie
header. The format is as follows: Set-Cookie: <name>=<value>; domain=<domain>
In your case, if you want to set the domain to <http://xyz.com|xyz.com>
, you would use: Set-Cookie: <name>=<value>; domain=<http://xyz.com|xyz.com>
This cookie will be sent in requests to <http://xyz.com|xyz.com>
and all subdomains of <http://xyz.com|xyz.com>
(for example <http://www.xyz.com|www.xyz.com>
, <http://api.xyz.com|api.xyz.com>
). Please note that Ory APIs must be exposed on the same domain as your application. If this requirement is not met, HTTP Cookies are ignored by the browser, which prevents the Ory Identities from functioning properly. Ory exposes the APIs at https://{project.slug}.<http://projects.oryapis.com|projects.oryapis.com>
. To manage session information, Ory Identities must be able to set the domain in HTTP Cookies to the same domain as the application that consumes its APIs. For local development, you can use Ory Proxy, a feature of the Ory CLI, which mirrors Ory endpoints on the same domain as the application you're running and rewrites cookies to match the domain your application is currently on. For more information, refer to the [Ory documentation on HTTP cookie domains](https://www.ory.sh/docs/security-model#http-cookie-domains) and [Ory CLI](https://www.ory.sh/docs/getting-started/integrate-auth/go#install-ory-cli).billions-minister-2901
02/26/2024, 5:40 PM<http://localhost:3000>
for local development, Ory must be able to set domain=localhost
in the HTTP cookie." How?chilly-king-10285
02/26/2024, 5:40 PMchilly-king-10285
02/26/2024, 5:41 PMdomain=localhost
in the HTTP cookie when working with an application that runs on <http://localhost:3000>
for local development, you need to use the Ory Tunnel or Ory Proxy. These tools allow Ory APIs to be exposed on the same domain as your application, which is a requirement for managing HTTP cookies. Here's how you can do it: 1. First, set up the Ory SDK URL which you can find in the [Ory Console](https://console.ory.sh/projects/current/developers/guides) bash export ORY_SDK_URL=https://{project.slug}.<http://projects.oryapis.com|projects.oryapis.com>
2. Then, start the Ory Tunnel: bash npx @ory/cli tunnel --dev <http://localhost:3000>
or use Ory Proxy: bash ory proxy --dev --project <your-project-slug> <http://localhost:3000>
The --dev
flag disables security checks for easier integration and should not be used when deploying the Tunnel to a staging environment. After running these commands, Ory APIs are now mirrored on <http://localhost:4000>
. Use that URL as the baseUrl
for the @ory/client
SDK. This allows Ory to set domain=localhost
in the HTTP cookie. For more information, refer to the [Ory Tunnel documentation](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel#ory-tunnel) and [Ory Proxy documentation](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel#ory-proxy).billions-minister-2901
02/26/2024, 5:45 PMchilly-king-10285
02/26/2024, 5:45 PMchilly-king-10285
02/26/2024, 5:45 PMxyz.local
instead of localhost
, you would need to use the Ory Tunnel or Ory Proxy. These tools allow Ory APIs to be exposed on the same domain as your application, which is a requirement for managing HTTP cookies. Here's how you can do it: 1. First, set up the Ory SDK URL which you can find in the [Ory Console](https://console.ory.sh/projects/current/developers/guides) bash export ORY_SDK_URL=https://{{project.slug}}.<http://projects.oryapis.com|projects.oryapis.com>
2. Then, start the Ory Tunnel: bash npx @ory/cli tunnel --dev <http://xyz.local:3000>
or use Ory Proxy: bash ory proxy --dev --project <your-project-slug> <http://xyz.local:3000>
The --dev
flag disables security checks for easier integration and should not be used when deploying the Tunnel to a staging environment. After running these commands, Ory APIs are now mirrored on <http://xyz.local:4000>
. Use that URL as the baseUrl
for the @ory/client
SDK. This allows Ory to set domain=xyz.local
in the HTTP cookie. For more information, refer to the [Ory Tunnel documentation](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel#ory-tunnel) and [Ory Proxy documentation](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel#ory-proxy).