ripe-alarm-21163
07/17/2024, 4:31 PM@ory/client
to @ory/client-fetch
. Basically from axios to fetch.chilly-king-10285
07/17/2024, 4:31 PMchilly-king-10285
07/17/2024, 4:32 PM@ory/client
(which uses axios) to @ory/client-fetch
(which uses fetch). However, I can provide some general guidance based on the usage of @ory/client
in the knowledge sources. In the @ory/client
, you typically create an instance of FrontendApi
with a Configuration
object. The Configuration
object includes a basePath
and baseOptions
with withCredentials: true
to ensure cookies are sent with CORS requests. Here's an example: javascript import { FrontendApi, Configuration } from "@ory/client" const ory = new FrontendApi( new Configuration({ basePath, baseOptions: { withCredentials: true, }, }), )
When making requests, you can use methods like ory.toSession()
to fetch the session directly from Ory. If you're migrating to fetch, you'll need to ensure that you're still sending cookies with your requests. In fetch, this is done by including credentials: 'include'
in the options for your fetch request: javascript fetch("<https://ory.your-custom-domain.com/>", { credentials: "include", })
Please refer to the official documentation or the specific @ory/client-fetch
library documentation for more detailed instructions on how to migrate.