<@U04UQ68083H> hey is there a way to put some valu...
# ory-copilot
s
@chilly-king-10285 hey is there a way to put some value into session.devices.location becuase by default it is always empty string?
b
A message from kapa.ai
I'm sorry, but the knowledge sources do not provide information on how to set or customize the value of session.devices.location in Ory. The examples show that the location field can be present, but in some cases, it is an empty string or a generic value like "Munich, DE" or "Berlin, DE"—however, there is no documentation or API reference describing how this value is determined or how to explicitly set it during session creation or update. It appears to be populated automatically, possibly based on IP geolocation, but this is not confirmed in the provided sources. If you need to control or enrich this value, you may need to handle it in your application logic outside of Ory's built-in session management features. For more details, you can review the session response examples in the documentation: - [Session response example](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api#session-response) - [Session checks example](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#session-checks)
s
@chilly-king-10285 but is there some hook that I can use to put value in there, like me get geoip data and set it there?
b
A message from kapa.ai
Based on the knowledge sources, there is no documented way to directly set or override the value of session.devices.location using hooks or webhooks in Ory. The documentation describes how you can use webhooks and Ory Actions to modify identity data (traits, metadata, etc.) during registration and settings flows, but it does not mention the ability to modify session or device information, including the location field in session.devices. Hooks and webhooks are primarily used for: - Modifying identity data during registration or settings flows. - Adding custom validation or business logic before/after login, registration, and other flows. - Integrating with external systems or triggering external logic on certain events. However, none of the sources indicate that you can inject or update the session.devices.location field via a hook or webhook, nor do they describe a mechanism for passing custom device or location data into the session object from your own logic or external service. The location field appears to be managed internally by Ory, possibly inferred from the IP address, but this is not explicitly documented or configurable via hooks or webhooks in the provided documentation [Trigger custom logic and integrate with external systems with webhooks](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks) [Overview: Ory Actions and Hooks](https://www.ory.sh/docs/kratos/hooks/configure-hooks). If you need to store custom geolocation data, you may consider adding it to the identity's metadata fields (metadata_public or metadata_admin) via a webhook during registration or settings flows, but this would not affect the session.devices.location field. Summary: There is no supported way, according to the current documentation, to set session.devices.location via hooks or webhooks. If this is a critical requirement, you may need to handle geolocation tracking in your own application logic outside of Ory's session management.