Auth0 Home Blog Docs

Getting the client's IP address inside custom database login

I have looked through the available Node.JS modules but can’t seem to work out if there is a way to obtain the client’s IP address during the login process.

I have seen in Rules we can do this via the context object ( but this is not made available to the login() function.

Has anyone done this before?

Hey @andreaskoepke!

I’m not experienced in Node.js and have no idea whether it’s possible to do that with it but as you said you can obtain user IP address with Rules.

Important thing to remember is that Rules are triggered at successful login

To obtain the IP address:

  • You need to access context object and its property request and then the ip property.

I’ll try to find out internally whether it’s doable any other way!

Can you provide me with more context around what you plan to do with client’s IP?

Hey there have you had time to see my last message?