fierce-pharmacist-13812
01/03/2025, 4:26 AMbrief-egg-61061
01/03/2025, 4:26 AMbrief-egg-61061
01/03/2025, 4:26 AMrelationships.json
with the following content: json [ { "namespace": "your_namespace", "object": "your_object", "relation": "your_relation", "subject_id": "your_subject_id" } ]
3. Use the ory create relationships
command to create the relationship tuple(s): ory create relationships relationships.json --project your_project_id
Replace your_project_id
with the ID of your Ory Network project. This command will create the relationship tuple(s) defined in the JSON file. For more detailed information on creating relationships, you can refer to the [Ory CLI documentation](https://www.ory.sh/docs/cli/ory-create-relationships). Note that you can also use the --format
flag to specify the output format, and the --quiet
flag to reduce output printing if needed. [Ory CLI documentation](https://www.ory.sh/docs/cli/ory-create-relationships)fierce-pharmacist-13812
01/07/2025, 8:46 AMbrief-egg-61061
01/07/2025, 8:46 AMbrief-egg-61061
01/07/2025, 8:47 AMGetIdentity
endpoint of the Identity API to retrieve the identity details, including their credentials. 2. When making the API call, you need to include the oidc
credential type in the request. Here's an example using Go: go func getTokens(identityId string) (cl client.IdentityCredentials, err error) { identity, _, err := ory.IdentityApi. GetIdentity(authed, identityId). IncludeCredential([]string{"oidc"}).Execute() if err != nil { return cl, err } return (*identity.Credentials)["oidc"], nil }
This function retrieves the identity details and includes the OIDC credentials. If the user has OIDC connections, they will be included in the response. You can check if the returned IdentityCredentials
object contains OIDC providers. If it does, the user has OIDC connections in their account. It's worth noting that when importing identities with social sign-in connections, the OIDC providers are stored in the credentials
field of the identity, under the oidc
key. This further confirms that OIDC connections are associated with the identity and can be retrieved. [Ory Identity Management Go SDK](https://www.ory.sh/docs/kratos/sdk/go#identity-api) [Importing credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities#social-sign-in-connections) Remember to handle this information securely, as it contains sensitive user data.fierce-pharmacist-13812
01/07/2025, 8:47 AMfierce-pharmacist-13812
01/07/2025, 8:50 AMbrief-egg-61061
01/07/2025, 8:50 AMbrief-egg-61061
01/07/2025, 8:50 AMtypescript import { Configuration, IdentityApi } from "@ory/client" const identity = new IdentityApi( new Configuration({ basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`, accessToken: process.env.ORY_API_KEY, }), ) export async function getTokens(identityId: string) { return await identity .getIdentity({ id: identityId, includeCredential: ["oidc"] }) .then(({ data }) => data) }
This code snippet does the following: 1. It imports the necessary components from the Ory SDK. 2. It creates an instance of the IdentityApi
with the appropriate configuration. 3. The getTokens
function takes an identityId
as a parameter and makes a call to the getIdentity
endpoint. 4. The includeCredential: ["oidc"]
parameter ensures that OIDC credentials are included in the response. After calling this function, you can check the returned data for the presence of OIDC credentials. If the user has OIDC connections, they will be included in the response under the credentials.oidc
property. [Ory Identities API](https://www.ory.sh/docs/kratos/reference/api#tag/identity/operation/getIdentity) Remember to replace process.env.ORY_PROJECT_SLUG
with your actual project slug and process.env.ORY_API_KEY
with your API key. This code will allow you to retrieve the identity information, including any OIDC connections associated with the user's account.