few-oyster-74399
10/25/2024, 2:14 PMbrief-egg-61061
10/25/2024, 2:14 PMbrief-egg-61061
10/25/2024, 2:14 PMredirect-uri
option. 2. For domains with similar patterns, you can use a wildcard () to match multiple subdomains. Here's an example of how to set this up using the Ory CLI: ``` ory create oauth2-client \ --grant-type authorization_code \ --response-type code \ --scope openid --scope offline_access \ --redirect-uri https://.example.com/callback This command creates an OAuth2 client that allows redirect URIs matching the pattern `https://*.<http://example.com/callback|example.com/callback>`, which would cover all subdomains of <http://example.com|example.com>. If you need to update an existing client, you can use the `update` command instead:
ory update oauth2-client {client.id} \ --redirect-uri https://*.example.com/callback ``` [Manage OAuth 2.0 and OpenID Connect clients](https://www.ory.sh/docs/hydra/guides/oauth2-clients#create-oauth2-client) Remember that when using wildcards, you should be cautious and specific to avoid potential security risks. It's generally safer to explicitly list all allowed redirect URIs if possible. Also, note that some OAuth2 providers might not support wildcard patterns for redirect URIs due to security considerations. In such cases, you would need to list each allowed redirect URI separately.few-oyster-74399
10/25/2024, 2:31 PMbrief-egg-61061
10/25/2024, 2:31 PMbrief-egg-61061
10/25/2024, 2:31 PMbash ory update oauth2-client {client.id} \ --redirect-uri <https://client1.example.com/callback> \ --redirect-uri <https://client2.example.com/callback> \ --redirect-uri <https://client3.example.com/callback>
In this example, client.id
is the ID of the OAuth2 client you want to update, and <https://client1.example.com/callback>
, <https://client2.example.com/callback>
, and <https://client3.example.com/callback>
are the redirect URIs for each client. Remember to replace {client.id}
with the actual ID of your OAuth2 client, and replace the example redirect URIs with your actual redirect URIs. You can find more information about updating OAuth2 clients in the [Ory CLI documentation](https://www.ory.sh/docs/cli/ory-update-oauth2-client#options).few-oyster-74399
10/25/2024, 2:33 PMbrief-egg-61061
10/25/2024, 2:33 PMbrief-egg-61061
10/25/2024, 2:34 PMbash ory update oauth2-client {client.id} \ --redirect-uri <https://central.example.com/redirect>
2. In your central redirect page, you can then determine the appropriate final redirect URI based on the state parameter, user information, or other factors. You can then redirect the user to the final redirect URI. Remember to ensure that your central redirect page is secure and does not allow open redirection, as this could be exploited by attackers. You can find more information about setting redirect URIs in the [Ory CLI documentation](https://www.ory.sh/docs/cli/ory-update-oauth2-client#options). Also, note that the exact implementation of your central redirect page will depend on your specific requirements and the technology stack you are using.