hi Siddharth,
Here is the answer for your query,
You can add custom attribute for saving ip address and use them in custom auth script to capture and stored in db.
here is the example in which we fetch ip address for auth script
please have a look
https://github.com/GluuFederation/oxAuth/blob/master/Server/integrations/allowed_countries/allowed_countries.py#L58
thanks and regards
Mohit Mali