bland-finland-95044
02/11/2025, 6:30 PM/projects/{project_id}/organizations
brief-egg-61061
02/11/2025, 6:30 PMbrief-egg-61061
02/11/2025, 6:30 PM/projects/{project_id}/organizations
, you should make direct API calls to the Ory API, not through the tunnel. Here's an example of how you might list organizations for a project using curl: bash curl -X GET "<https://api.console.ory.sh/projects/$PROJECT_ID/organizations>" \ -H "Authorization: Bearer $WORKSPACE_API_KEY"
Remember to replace $PROJECT_ID
with your actual project ID and $WORKSPACE_API_KEY
with your Workspace API Key. It's important to note that Ory Tunnel is primarily used for local development to mirror Ory APIs on your local machine, particularly for features that require the same top-level domain (like cookies and CORS). For workspace-level operations, you should interact directly with the Ory API or use the Ory CLI. Sources: [Ory API Reference](https://www.ory.sh/docs/reference/api) [Authorizing Ory Network Workspace Admin APIs](https://www.ory.sh/docs/concepts/personal-access-token#authorizing-ory-network-workspace-admin-apis) [Ory Proxy and Ory Tunnel](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel)bland-finland-95044
02/14/2025, 8:49 PMbrief-egg-61061
02/14/2025, 8:49 PMbrief-egg-61061
02/14/2025, 8:49 PM1. The user creates an account with the identifier `<mailto:user@example.com|user@example.com>` and a password.
2. When signing in later, the user signs in with a social sign-in provider. That social sign-in account contains the same identifier `<mailto:user@example.com|user@example.com>`.
3. Since the identifier already exists, the user can't be logged in directly. Instead, the user will be prompted to enter the password chosen in step 1.
4. After entering the correct password, the social sign-in is linked to the user's account.
3. In your Next.js application, you would need to handle this flow. Here's a conceptual example of how you might implement this in a component:
```jsx
import { useEffect, useState } from "react"
import { useRouter } from "next/router"
import { Configuration, FrontendApi } from "@ory/client"
import { edgeConfig } from "@ory/integrations/next"
const ory = new FrontendApi(new Configuration(edgeConfig))
export default function LinkAccount() {
const router = useRouter()
const [error, setError] = useState(null)brief-egg-61061
02/14/2025, 8:49 PM1. The user creates an account with the identifier `<mailto:user@example.com|user@example.com>` and a password. 2. When signing in later, the user signs in with a social sign-in provider. That social sign-in account contains the same identifier `<mailto:user@example.com|user@example.com>`. 3. Since the identifier already exists, the user can't be logged in directly. Instead, the user will be prompted to enter the password chosen in step 1. 4. After entering the correct password, the social sign-in is linked to the user's account.
3. In your Next.js application, you would need to handle this flow. Here's a conceptual example of how you might implement this in a component: jsx import { useEffect, useState } from "react" import { useRouter } from "next/router" import { Configuration, FrontendApi } from "@ory/client" import { edgeConfig } from "@ory/integrations/next" const ory = new FrontendApi(new Configuration(edgeConfig)) export default function LinkAccount() { const router = useRouter() const [error, setError] = useState(null) useEffect(() => { ory.toSession() .then(({ data: session }) => { // Check if there's a pending account link if (session.identity.credentials.oidc) { // Prompt user to enter password to link accounts // This is a simplified example. You'd need to implement // a form to collect the password securely. const password = prompt("Enter your password to link accounts:") if (password) { ory.updateLoginFlow({ flow: session.identity.id, updateLoginFlowBody: { method: "password", password: password } }) .then(() => { // Account linked successfully router.push("/dashboard") }) .catch((err) => setError(err.message)) } } }) .catch((err) => setError(err.message)) }, [router]) if (error) return <div>Error: {error}</div> return <div>Linking account...</div> }
Please note that this is a simplified example and doesn't include all necessary error handling or security measures. In a real-world application, you would need to implement a secure form for password entry and handle various edge cases. Also, remember to enable [login hints](https://www.ory.sh/docs/kratos/social-signin/link-multiple-provider-account#hide-irrelevant-authentication-methods) in your Ory configuration to inform users about the authentication methods available for their existing account. For the most up-to-date and accurate implementation details, I recommend checking the latest Ory documentation or reaching out to Ory support for specific guidance on implementing SSO account linking in Next.js.