Yes, you can add specific data to your JWT token when calling the route to get a token from Ory Hydra. This can be achieved through a few different methods: 1. Custom Claims via OAuth2 Webhooks: Ory Hydra allows you to add custom claims to your tokens using OAuth2 webhooks. You can set up a webhook that will be called before the token is issued, allowing you to add custom data to the token. This is done by configuring a webhook endpoint in your OAuth2 configuration and then responding to that webhook with the custom claims you want to add. [Customizing claims with OAuth2 webhooks](
https://www.ory.sh/docs/hydra/guides/claims-at-refresh) provides detailed information on how to set this up. 2. Custom Consent UI: If you're using the Authorization Code flow, you can add custom claims during the consent phase. This is done by modifying the acceptance of the consent request. [Custom consent UI and custom claims for JWT access token](
https://www.ory.sh/docs/oauth2-oidc/jwt-access-token#custom-consent-ui-and-custom-claims-for-jwt-access-token) shows an example of how to add custom claims during consent acceptance. 3. Allowed Top Level Claims: By default, custom claims are added under the
ext
claim in the token. If you want your custom claims to appear at the top level of the token, you need to modify the
/oauth2/allowed_top_level_claims
configuration. [Custom consent UI and custom claims for JWT access token](
https://www.ory.sh/docs/oauth2-oidc/jwt-access-token#custom-consent-ui-and-custom-claims-for-jwt-access-token) also explains how to configure this. It's important to note that these methods apply to different OAuth2 flows and scenarios. The specific method you'll use depends on your exact use case and the OAuth2 flow you're implementing.