Published on

Announcing LoginLlama for Node.js

In an effort to make it even easier to integrate with LoginLlama, I’m happy to announce there is now a package for Node.Js.

You can find it on NPM here: https://www.npmjs.com/package/loginllama

The package not only provides a function to send the customers IP address and user agent manually. But, it also allows for passing ExpressJS request objects.

In this way, you don’t need to worry how to fetch the customers information. The package does it for you!

Here’s how to use it.

First download it

npm i -s loginllama

Simply import it

const { LoginLlama } = require('loginllama');

// or for import
import { LoginLlama } from 'loginllama';

Then invoke it with the API key. Alternatively if the API key is set in the environment then you can leave this blank.

const loginLlama = new LoginLlama('API_KEY');

Then check the login Either manually...

const loginCheckResult = await loginllama.check_login({
  ip_address: '192.168.1.1',
  user_agent: 'Mozilla/5.0',
  identity_key: 'user123'
});

Or by passing the request object.

const loginCheckResult = await loginllama.check_login({
  request: req, // express request object
  identity_key: 'user123'
});

This will be the first of many “wrapper” packages that I’ll be building. So stay tuned for the PHP, Python and Go packages.