Hi,
I need the IP Address of the user not of the retool servers.
How do I get the "users" IP address?
Hi,
I need the IP Address of the user not of the retool servers.
How do I get the "users" IP address?
I know request data is stored in the Audit logs, but I don't know of a way to access the same data from within an App/Module (if that is what you need).
Perhaps you could capture the request headers at the time of a component interaction but I haven't attempted to do that yet.
Thanks for your input. On my server I do capture the request headers but the request is coming from Retools servers. I need the "Client" or "Users" IP address.
Understood. That's why I mentioned the Audit Logs. The end user IP info is stored there so it is coming through the app, but likely not in a way accessible by the app.
So if anyone needs a solution. here ya go.
let ipAddress = null;
async function fetchIPAddress() {
try {
const response = await fetch("https://api.ipify.org?format=json");
const data = await response.json();
ipAddress = data.ip;
} catch (error) {
console.error("Failed to fetch IP address:", error);
}
}
async function main() {
await fetchIPAddress();
state_ipAddress.setValue(ipAddress);
}
main();