1.0.28 β€’ Published 4 years ago

device-ip-location v1.0.28

Weekly downloads
799
License
ISC
Repository
github
Last release
4 years ago

device-ip-location

Get device information from your systems users: Device model and version, operating system and version, and an abundance of location information from their ip address

Use for security management i.e password resetting & detecting new sign in devices etc.

See https://www.npmjs.com/package/device-ip-location

Install

npm i device-ip-location

Usage

const device = require('device-ip-location');

//Make sure to bypass the reverse proxy by allowing for IP visibility by enabling proxy trust if you're using express:
app.enable('trust proxy');

// Use the request data to access the required parameters (ip and header)
// Example agent - 'Mozilla/5.0 (Linux; Android 5.0; NX505J Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36';
var agent = req.headers['user-agent'];
// Example requestIp - 105.4.4.147
var requestIp = req.ip

device.getInfo(agent,requestIp,function(err,res){
    if(err){
        console.log(err);
        return
    } 
    console.log(res);
})

Result parse

{ "device":
   { "os":
      { "short_name": "WIN",
        "name": "Windows",
        "version": "10",
        "platform": "x64",
        "family": "Windows" },
     "device": { "id": "", "type": "desktop", "brand": "", "model": "" },
     "client":
      { "engine": "Blink",
        "engine_version": "",
        "short_name": "CH",
        "name": "Chrome",
        "version": "69.0.3497.100",
        "type": "browser" } },
  "locale":
   { "ip": "105.4.4.147",
     "type": "ipv4",
     "continent_code": "AF",
     "continent_name": "Africa",
     "country_code": "ZA",
     "country_name": "South Africa",
     "region_code": "GT",
     "region_name": "Gauteng",
     "city": "Johannesburg",
     "zip": "2000",
     "latitude": -26.2309,
     "longitude": 28.0583,
     "location":
      { "geoname_id": 993800,
        "capital": "Pretoria",
        "languages": [],
        "country_flag": "http://assets.ipstack.com/flags/za.svg",
        "country_flag_emoji": "πŸ‡ΏπŸ‡¦",
        "country_flag_emoji_unicode": "U+1F1FF U+1F1E6",
        "calling_code": "27",
        "is_eu": false } } }
1.0.28

4 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago