<@U04UQ68083H> what typescript type is this object...
# ory-copilot
s
@chilly-king-10285 what typescript type is this object, is it exported from ory hydra? it is from token_hook { session: { id_token: { id_token_claims: [Object], headers: [Object], expires_at: [Object], username: '', subject: 'ac507b07-d085-4bba-b578-eae3a7f67707' }, extra: {}, kid: '', client_id: '2b14dc35-a426-4e85-bc0a-832385dd4711', consent_challenge: 'c8e34bd2-6ad5-4b75-99eb-e6eb00886bfa', exclude_not_before_claim: false, allowed_top_level_claims: [], mirror_top_level_claims: true }, request: { client_id: '2b14dc35-a426-4e85-bc0a-832385dd4711', granted_scopes: [], granted_audience: [], grant_types: [ 'authorization_code' ], payload: {} } }
b
A message from kapa.ai
The object you provided is the payload sent by Ory Hydra to a token_hook webhook, as described in the documentation for customizing claims with OAuth2 webhooks. The structure matches the example payload shown in the docs, with top-level properties session and request, and nested fields like id_token, client_id, consent_challenge, etc. [Customizing claims with OAuth2 webhooks](https://www.ory.sh/docs/hydra/guides/claims-at-refresh). However, the knowledge sources do not specify a TypeScript type or interface exported from the Ory Hydra SDK that directly matches this webhook payload structure. The documentation provides JSON examples but does not mention an exported type or interface for this object in the TypeScript SDK. If you need to use this structure in TypeScript, you would need to define your own type or interface based on the documented payload. For example:
Copy code
typescript interface TokenHookPayload {   session: {     id_token: {       id_token_claims: Record<string, any>       headers: Record<string, any>       expires_at?: any       username: string       subject: string     }     extra: Record<string, any>     kid: string     client_id: string     consent_challenge: string     exclude_not_before_claim: boolean     allowed_top_level_claims: string[]     mirror_top_level_claims?: boolean   }   request: {     client_id: string     granted_scopes: string[]     granted_audience: string[]     grant_types: string[]     payload: Record<string, any>   } }
To summarize: - This object is not exported as a TypeScript type from the Ory Hydra SDK according to the available documentation. - You should define your own type/interface in your codebase based on the documented structure if you need strong typing in TypeScript. If you need further details, you can refer to the [webhook payload documentation](https://www.ory.sh/docs/hydra/guides/claims-at-refresh).