User ip info in custom login
Hi team. In a hosted login session info like user's device information, ip or location , zitadel handles them . I am using a custom login ui , can you please help me on how get the info like user's device information, ip , location in custom login.
I am currently trying to use https://zitadel.com/docs/apis/resources/session_service_v2/session-service-create-session this API . In this api we need to provide ip in the api request, can you tell me how can I retrieve the ip info in custom login
ZITADEL Docs
Create a new session. A token will be returned, which is required for further updates of the session.
8 Replies
Hi, any update on this 🙂 ?
Could you describe the flow you have in mind?
We are using a cloud instance with a custom login UI. When creating a user session, we need to capture user agent information (e.g., IP address, device details, location). Currently, ZITADEL automatically captures this data when sessions are created via its default login UI. We want to achieve the same functionality with our custom login flow. Could you suggest a method for implementing this?
If users hit your service directly, you should have their IP address etc. in the request information.
Assuming there is a reverse proxy in place you have to make sure it passes the IP via the corresponding header fields and you handle those for trusted reverse proxies.
So it only depends on your application..
We provided a reverse proxy and passed the required header fields but still when we hit the session APIs , the response gives only this :
{
"details": {
"timestamp": "2025-07-10T05:53:30.825117Z"
}
}
I'm still not sure if I understand the logical flow correctly.
Could you draw me the communications flow (at what time does one application another one).
Also if you mention an API endpoint, please append your request (except for any sensitive information like tokens).
we need to capture the user agent info when users hit the https://$CUSTOM-DOMAIN/v2/sessions/:sessionId API. When I hit the API I am being returned with the following response:
{"session":{"id":"xxxxxx", "creationDate":"2025-07-23T17:56:05.779407Z", "changeDate":"2025-07-23T17:56:05.779407Z", "sequence":"3", "factors":{"user":{"verifiedAt":"2025-07-23T17:56:05.770855Z", "id":"xxxxxx", "loginName":"xxxxxxxxx", "displayName":"xxxxxxx", "organizationId":"xxxxxxxx"}}}}
I can see that the user agent details are not returned in the response. Could you please tell me how I should be calling the API such that I get the user agent info in the response of this API.
Or if there is a certain method or a certain configuration to follow to get the user agent info for this API please help me find it.
Thank you.
Could your describe your use case?
Why would you need the user agent, when the user hits an API endpoint?
Or: Why would you need the user agent at all?