orange-rose-10706
11/22/2024, 9:32 PMbrief-egg-61061
11/22/2024, 9:32 PMbrief-egg-61061
11/22/2024, 9:32 PMyaml session: cookie: domain: <http://your-main-domain.com|your-main-domain.com>
This setting allows the cookie to be sent to all subdomains of <http://your-main-domain.com|your-main-domain.com>
. 2. Same-Site Attribute: The SameSite attribute of the cookie might be restricting its transmission to subdomains. You can adjust this in your configuration as well: yaml session: cookie: same_site: Lax
[Ory's cookie-based security model documentation](https://www.ory.sh/docs/security-model) explains that they use SameSite=Strict by default, which could prevent cookies from being sent to subdomains in some cases. 3. HTTPS Requirement: Ory cookies are typically set with the 'secure' flag, meaning they're only sent over HTTPS connections. Ensure that your subdomains are also using HTTPS. 4. Public Suffix Domains: If you're using a domain that's on the public suffix list, you might encounter issues. As mentioned in the [CSRF troubleshooting documentation](https://www.ory.sh/docs/troubleshooting/csrf), you may need to use a subdomain that's not on the public suffix list. 5. Local Development: If you're testing locally, make sure you're using the Ory Tunnel correctly, as explained in the [local development documentation](https://www.ory.sh/docs/getting-started/local-development#local-development). If you've checked all these points and are still having issues, you might need to review your specific setup and configuration. Remember that cookie behavior can be complex, especially when dealing with subdomains and security settings.orange-rose-10706
11/22/2024, 9:37 PMorange-rose-10706
11/22/2024, 9:38 PMbrief-egg-61061
11/22/2024, 9:38 PMbrief-egg-61061
11/22/2024, 9:38 PM<http://app.example.com|app.example.com>
, you would set the Cookie Domain to <http://example.com|example.com>
. This allows the cookie to be available on this domain and all its subdomains [as explained in the custom domains guide](https://www.ory.sh/docs/guides/custom-domains). 3. SDK Configuration: After setting up the custom domain, update your SDK configuration to use the custom domain URL. For example: typescript const ory = new sdk.FrontendApi( new sdk.Configuration({ basePath: "<https://ory.example.org>", baseOptions: { withCredentials: true, }, }), )
This ensures that your application uses the correct domain for API requests [as shown in the Express.js integration guide](https://www.ory.sh/docs/getting-started/integrate-auth/expressjs#go-to-production). 4. CORS Configuration: If you're using Single Page Applications (SPAs), make sure to add the appropriate CORS origins to your custom domain settings. Ory Network allows up to 50 origins [according to the custom domains documentation](https://www.ory.sh/docs/guides/custom-domains). By following these steps, your Ory Network cookies should work across your main domain and its subdomains. Remember that this feature is only available on paid plans, and you may need to contact Ory support if you encounter any issues during setup.orange-rose-10706
12/02/2024, 7:06 AMbrief-egg-61061
12/02/2024, 7:06 AMbrief-egg-61061
12/02/2024, 7:07 AMcreateNativeRegistrationFlow
method from the FrontendApi
. Here's an example of how to do this using the JavaScript SDK: javascript import { Configuration, FrontendApi } from "@ory/client" const frontend = new FrontendApi( new Configuration({ basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`, }), ) export async function createRegistration() { return await frontend.createNativeRegistrationFlow() }
This code snippet is based on the example provided in the [Ory documentation for creating a registration flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#create-registration-flow). 3. After creating the registration flow, you'll need to handle the passkey registration process. This involves using the WebAuthn API, which Ory supports through its passkey strategy. Make sure you have enabled passkeys in your Ory project configuration [as described in the passkey documentation](https://www.ory.sh/docs/kratos/passwordless/passkeys#passkeys-with-the-dedicated-passkey-strategy). 4. To complete the registration, you'll need to update the registration flow with the passkey information. This is done using the updateRegistrationFlow
method. Here's an example: javascript async function submitRegistration(flowId, passkey) { const result = await frontend.updateRegistrationFlow({ flow: flowId, updateRegistrationFlowBody: { method: "passkey", passkey: passkey, traits: { /* user traits */ }, } }) .then(({ data }) => data) return result }
This example is adapted from the [Ory SDK documentation for submitting a registration flow](https://www.ory.sh/docs/kratos/sdk/go#submit-registration-flow). 5. Remember to include the necessary WebAuthn JavaScript in your application: html <head> <script src="/.well-known/ory/webauthn.js"></script> </head>
This script is required for handling WebAuthn operations, as mentioned in the [Ory documentation for passwordless authentication](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-advanced-integration#passwordless-authentication). Please note that the exact implementation may vary depending on your specific application requirements and the user interface you're building. Also, ensure that you're using the latest version of the Ory SDK, as the API might have slight variations between versions.orange-rose-10706
12/02/2024, 7:08 AM