bland-finland-95044
01/23/2025, 3:42 PMbrief-egg-61061
01/23/2025, 3:42 PMbrief-egg-61061
01/23/2025, 3:42 PMoryWorkspaceApiKey
method. The [Docs > Kratos > B2B Single Sign-On & SAML](https://www.ory.sh/docs/kratos/organizations) section also mentions that managing organizations, whether through the Ory Console or API, requires a workspace API key for authentication. Furthermore, the [Docs > Concepts > Ory Network API Keys](https://www.ory.sh/docs/concepts/personal-access-token#authorizing-ory-network-workspace-admin-apis) emphasizes that workspace API keys are necessary for authorizing privileged operations, including those related to B2B SSO organizations within a project. Given this information, it appears that a workspace API key is required for any operations involving organizations, including querying which organization an email domain belongs to. There is no mention of a public API or method to perform this query without authentication.bland-finland-95044
01/24/2025, 6:36 PMbrief-egg-61061
01/24/2025, 6:36 PMbrief-egg-61061
01/24/2025, 6:37 PMclient_secret_basic
method. This means the client expects the credentials to be sent in the Authorization header. 3. Request Method: However, the error suggests that the request is using the client_secret_post
method, which means the credentials are being sent in the POST body. To resolve this issue, you have two options: 1. Change the request method: Modify your token request to use the client_secret_basic
method. This involves sending the client ID and secret in the Authorization header. Example: curl -X POST '<http://127.0.0.1:4444/oauth2/token>' \ -H 'Authorization: Basic base64(client_id:client_secret)' \ -H 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials'
2. Update the client configuration: Alternatively, you can update the OAuth 2.0 client configuration to support the client_secret_post
method. You can do this using the Ory CLI: ory update oauth2-client --token-endpoint-auth-method client_secret_post
Or via the API: curl --request PUT '<http://127.0.0.1:4445/admin/clients/{client_id}>' \ --header 'Content-Type: application/json' \ --data-raw '{ "token_endpoint_auth_method": "client_secret_post" }'
For more details on configuring OAuth 2.0 clients, you can refer to the [Ory documentation on managing OAuth 2.0 clients](https://www.ory.sh/docs/hydra/guides/oauth2-clients). Remember, it's crucial to ensure that the client authentication method used in the request matches the method configured for the client to successfully complete the OAuth 2.0 client credentials grant flow.bland-finland-95044
02/07/2025, 5:09 PMbrief-egg-61061
02/07/2025, 5:09 PMbrief-egg-61061
02/07/2025, 5:09 PMbland-finland-95044
02/07/2025, 5:10 PMbrief-egg-61061
02/07/2025, 5:10 PMbrief-egg-61061
02/07/2025, 5:11 PMtypescript import { Namespace, Context } from "@ory/keto-namespace-types" class User implements Namespace {} class Application implements Namespace { related: { trial_users: User[] } permits = { access: (ctx: Context): boolean => { const now = new Date(); const trialStart = new Date(ctx.subject.metadata.trial_start); const trialEnd = new Date(trialStart.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30 days trial return this.related.trial_users.includes(ctx.subject) && now < trialEnd; } } }
In this example: 1. We define a User
namespace to represent users. 2. We define an Application
namespace with a trial_users
relationship to represent users who have access to the trial. 3. We create an access
permission that checks if the user is in the trial_users
relationship and if their trial period is still active. To use this in your application: 1. When a user starts a trial, you would create a relationship: ory create relationship Application:your_app_id#trial_users@User:user_id
2. You would also need to store the trial start date as metadata for the user. This isn't directly supported in Ory Permissions, so you'd need to store this in your application's database or use a custom claim in the user's ID token. 3. When checking if a user has access, you would make a permission check: ory is allowed User:user_id access Application your_app_id
This implementation has some limitations: 1. It doesn't automatically remove expired trial users. You'd need to implement a separate process to clean up expired relationships. 2. It relies on storing the trial start date outside of Ory Permissions. For a more robust solution, you might consider combining this with other Ory features or implementing part of the logic in your application. Remember, this is a basic example and may need to be adapted based on your specific requirements and the full capabilities of your Ory Network setup. For more detailed information on using Ory Permissions and the Ory Permission Language, you can refer to the [Ory Permission Language specification](https://www.ory.sh/docs/keto/reference/ory-permission-language#examples) and the [guide on creating a permission model](https://www.ory.sh/docs/keto/modeling/create-permission-model).