<@U04UQ68083H> How can we implement authorization ...
# ory-copilot
s
@chilly-king-10285 How can we implement authorization code flow of hydra without UI or any user to grant consent.
c
A message from kapa.ai
In Ory Hydra, it's not possible to completely omit the consent redirection flow. However, you can accept the redirection to the redirect URL immediately. This process is so quick (less than 100ms) that the user won't notice it. To implement this, you can follow the example provided in the Hydra documentation on how to skip the consent screen. This will provide a good starting point for your implementation. Please note that this approach doesn't completely eliminate the consent flow, but it does make it invisible to the user. For more details, you can refer to the [Hydra FAQ](https://www.ory.sh/docs/hydra/faq#how-to-omit-consent-redirection) and the guide on [Skipping Consent Screen](https://www.ory.sh/hydra/docs/guides/consent/#skipping-consent-screen).
s
@chilly-king-10285 Can we get refresh token in client credentials flow of ory hydra
c
A message from kapa.ai
No, you cannot obtain a refresh token in the client credentials flow of Ory Hydra. The client credentials flow does not support refresh tokens. This is because the client credentials flow is designed for server-to-server communication and does not involve a user, hence there is no need for a refresh token. For more details, you can refer to the [Requirements for obtaining a refresh token](https://www.ory.sh/docs/oauth2-oidc/refresh-token-grant#requirements-for-obtaining-a-refresh-token) section in the Ory documentation.
s
@chilly-king-10285 how to change the webhook url of my ory project
c
A message from kapa.ai
You can change webhook-related URLs in your Ory Network project via the Ory CLI, depending on which webhook you mean. 1. OAuth2 token webhook URL (Hydra / Ory OAuth2 & OpenID) If you’re changing the OAuth2 token hook URL (used to customize tokens), update the OAuth2 config with `ory patch oauth2-config`:
Copy code
ory patch oauth2-config --project <project-id> --workspace <workspace-id> \
  --replace '/oauth2/token_hook/url="https://my-example.app/new-token-hook"' \
  --format yaml
If you haven’t configured it before, you may need to set the full object instead of just the URL, for example:
Copy code
ory patch oauth2-config --project <project-id> --workspace <workspace-id> \
  --add '/oauth2/token_hook={"url":"https://my-example.app/new-token-hook","auth":{"type":"api_key","config":{"name":"X-API-Key","value":"MY_API_KEY","in":"header"}}}' \
  --format yaml
The token hook configuration and CLI usage are described in the OAuth2 CLI and webhook docs.[Configure OAuth2; Token webhook] 2. Other project configuration webhooks (identity, actions, etc.) For other webhooks that live in the project configuration (for example, Ory Actions or identity hooks), you change them with `ory patch project`:
Copy code
ory patch project --project <project-id> --workspace <workspace-id> \
  --replace '/services/identity/config/selfservice/flows/login/after/hooks/0/config/url="https://my-example.app/new-hook"' \
  --format json-pretty
The exact JSON path depends on where the webhook is defined in your config; you can first fetch the project config:
Copy code
ory get project --project <project-id> --workspace <workspace-id> --format json
Then adjust the relevant
url
field using
--replace
(or
--add
) as shown in the general project-config guide.[Configure projects; Patch project] If you clarify which webhook (OAuth2 token hook, identity hook, Ory Action, etc.), I can give the exact JSON path to patch. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.