<@U04UQ68083H> how do I switch workspace in ory cl...
# ory-copilot
w
@chilly-king-10285 how do I switch workspace in ory cli
c
A message from kapa.ai
To switch workspace in Ory CLI, you can use the
ory use
command. However, the exact command to switch workspace is not specified in the provided knowledge sources. The
ory use
command is used to use a resource, and it has several options such as specifying the path to the Ory Network configuration file, setting the output format, and confirming all dialogs with yes. Here is the general format of the
ory use
command:
Copy code
bash ory use [options]
Options include:
Copy code
bash   -c, --config string   Path to the Ory Network configuration file.         --format string   Set the output format. One of default, json, yaml, json-pretty, jsonpath and jsonpointer. (default "default")     -h, --help            help for use     -q, --quiet           Be quiet with output printing.     -y, --yes             Confirm all dialogs with yes.
For more specific instructions on how to switch workspace using the Ory CLI, you may need to refer to the Ory CLI documentation or help command. Source: [Ory CLI Use](https://www.ory.sh/docs/cli/ory-use#ory-use)
w
@chilly-king-10285 when we use @ory/client in out React app the session cookies are not set for somereason and then the login fails
c
A message from kapa.ai
When using the
@ory/client
in your React application, it's important to ensure that you have correctly configured the SDK to include cookies in the request. This is done by setting the
withCredentials: true
option in the SDK configuration. Here's an example:
Copy code
jsx import { Configuration, FrontendApi, Session } from "@ory/client"   import { useEffect, useState } from "react"      const frontend = new FrontendApi(     new Configuration({       basePath: "<http://localhost:4000>", // Use your local Ory Tunnel URL       baseOptions: {         withCredentials: true,       },     }),   )
(Source: [Ory Documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#session-checks)) If you're building a Single-Page Application (SPA), you also need to ensure that your AJAX request is configured to include cookies. For example, when using the browser's
fetch
function, you need to set
credentials: 'include'
. (Source: [Ory Documentation](https://www.ory.sh/docs/troubleshooting/csrf#accessing-apis-from-client-side-javascript--ajax)) Also, ensure that your application and the Ory APIs are on the same domain. This is because the Ory security model uses HTTP cookies to manage sessions, tokens, and cookies. When developing locally, use either
localhost
or
127.0.0.1
, but not both. Using both interchangeably in your code can cause problems with the origin of HTTP cookies sent by the application. (Source: [Ory Documentation](https://www.ory.sh/docs/getting-started/integrate-auth/react#run-ory-apis-on-localhost)) If you've done all of these and the issue persists, it might be helpful to check the browser's console for any error messages or warnings that could provide more insight into the problem.