<@U04UQ68083H> where do I see which are the list o...
# ory-copilot
s
@chilly-king-10285 where do I see which are the list of pre defined redirect urls? and how do I change them?
b
A message from kapa.ai
The predefined redirect URLs are typically configured in your Ory project's configuration. Here's how you can view and change them: 1. Viewing the Redirect URLs: The redirect URLs are usually defined in your project's configuration file (often a
yaml
file). For instance, in the context of OAuth2 login and consent, the redirect URLs are specified under
oauth2/urls/consent
and
oauth2/urls/login
in the configuration file. You can view these URLs by fetching the OAuth2 Federation Service configuration of your project using the Ory CLI commands:
Copy code
bash ## List all available workspaces   ory list workspaces      ## List all available projects   ory list projects --workspace <workspace-id>      ## Get config   ory get oauth2-config --project <project-id> --workspace <workspace-id> --format yaml > config.yaml
2. Changing the Redirect URLs: You can adjust these URLs to point to pages that handle these operations in your setup. For instance, if you want to change the login and consent URLs to point to your application running at
<http://localhost:3000>
, you can do so by adjusting the configuration in
oauth2/urls/consent
and `oauth2/urls/login`:
Copy code
yaml oauth2:     # ...     urls:       consent: <http://localhost:3000/consent>       error: /oauth2/fallbacks/error       login: <http://localhost:3000/login>       post_logout_redirect: /oauth2/fallbacks/logout
After making the changes, you can update the project configuration using the file you worked with:
Copy code
bash ory update oauth2-config --project <project-id> --workspace <workspace-id> --file config.yaml
Please note that the exact commands and configuration paths may vary depending on the specific Ory product and version you are using. Always refer to the relevant [Ory documentation](https://www.ory.sh/docs/) for the most accurate information. Sources: - [Configure Ory Network](https://www.ory.sh/docs/hydra/guides/custom-ui-oauth2#configure-ory-network) - [Browser redirects and flow completion](https://www.ory.sh/docs/concepts/redirects)
s
@chilly-king-10285 whenever I try to use the cli I get sent to a login page but I see the error than once, or is otherwise malformed. The ‘redirect_uri’ parameter does not match any of the OAuth 2.0 Client’s pre-registered redirect urls. so I am effectively locked out
b
A message from kapa.ai
The error message you're seeing indicates that the
redirect_uri
you're using doesn't match any of the pre-registered redirect URIs for your OAuth 2.0 client. This mismatch can occur due to a variety of reasons, such as a typo in the
redirect_uri
, or the
redirect_uri
not being whitelisted in your client configuration. Here's how you can troubleshoot this issue: 1. Check the
redirect_uri
: Ensure that the
redirect_uri
query parameter in the URL matches the authorized redirect URI added to the social sign-in provider. The URLs must match exactly. For example,
<http://my-url/callback>
and
<http://my-url/callback?foo=bar>
are considered different URLs. 2. Check the OAuth 2.0 Client Configuration: You can check the client configuration using the Ory CLI with the command
ory get oauth2-client {client.id}
. This will show you the whole client configuration (excluding its secret). Check that the
redirect_uris
field contains the correct URLs. 3. Update the OAuth 2.0 Client Configuration: If the
redirect_uri
is not in the list of
redirect_uris
, you need to add it. This can be done by updating the client configuration. Unfortunately, the exact command to do this is not provided in the knowledge sources. 4. Projects Created Before September 2022: If you're working on a project created before September 2022 that uses a custom domain, you might need to remove the
/selfservice/methods/oidc/config/base_redirect_uri
configuration entry. This can be done using the Ory CLI with the command
ory patch identity-config <project-id> --remove '/selfservice/methods/oidc/config/base_redirect_uri'
. Please note that the exact commands and configuration paths may vary depending on the specific Ory product and version you are using. Always refer to the relevant [Ory documentation](https://www.ory.sh/docs/) for the most accurate information. Sources: - ['redirect_uri' mismatch](https://www.ory.sh/docs/troubleshooting/troubleshooting-social-sign-in#redirect_uri-mismatch) - [Social sign-in
redirect_uri_mismatch
error (OTA-092022-01)](https://www.ory.sh/docs/troubleshooting/oidc-redirect-url-cname-OTA-092022-01) - [Wrong or misconfigured OAuth 2.0 client](https://www.ory.sh/docs/hydra/debug#refresh-token-flow-fails) - [Redirect URL isn't whitelisted](https://www.ory.sh/docs/hydra/debug#refresh-token-flow-fails)