Skip to content

Latest commit

 

History

History
114 lines (101 loc) · 4.33 KB

File metadata and controls

114 lines (101 loc) · 4.33 KB

Suspicious Login & Threat Detection API

Zenlogin is a security API that helps you secure your login and signup flows. After signing up, you'll be given an API endpoint and secret key. By integrating these into your authentication flow, Zenlogin will then detect any suspicious login attempts and email the user (from an email address you choose) to inform them of the login.

This email is a rich HTML email, including a Google Map showing the approximate location. It also provides them with other metadata including:

  • The login device
  • The login operating system
  • The date & time (relative to that location's timezone)

Auth0 Integration

If you're using Auth0 for your authentication, you can now add Zenlogin without touching any code. Our integration can be accessed here: https://marketplace.auth0.com/integrations/zenlogin

Advanced Features

Below are some advanced features available for our users:

  • Detailed logs
  • Localization
  • Custom Rules (e.g. "Always notify users logging in with an @zenlogin.co account")
  • Map styling
  • Link and color customization
  • Webhooks
  • DNS CNAMEs
  • DPAs

Email Preview

Below you can see a sample email that Zenlogin sends:

Integration

The integration process for Zenlogin is straightforward. Below you'l find some examples:

curl

curl https://api.zenlogin.co/v1/applications/appl0123456789/logins/checks \
  --header "X_API_SECRET_KEY: your_secret_key" \
  --data identity_key="usr12345" \
  --data identity_email_address="[email protected]" \
  --data user_agent="Mozilla/5.0 (Windows NT 6.1; rv:74.0) Gecko/20100101 Firefox/74.0" \
  --data ip_address="2607:f2c0:e34c:36b0:ac91:fd58:c9b7:7f03"

PHP

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zenlogin.co/v1/applications/appl0123456789/logins/checks');
$postData = array();
$postData['identity_key'] = 'usr12345';
$postData['identity_email_address'] = '[email protected]';
$postData['user_agent'] = 'Mozilla/5.0 (Windows NT 6.1; rv:74.0) Gecko/20100101 Firefox/74.0';
$postData['ip_address'] = '2607:f2c0:e34c:36b0:ac91:fd58:c9b7:7f03';
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'X_API_SECRET_KEY: your_secret_key'
));
$response = curl_exec($ch);
$response = json_decode($response, true);
curl_close($ch);

Node

const axios = require('axios');
const endpoint = 'https://api.zenlogin.co/v1/applications/appl0123456789/logins/checks',
  postData = {},
  options = {};
postData.identity_key = 'usr12345';
postData.identity_email_address = '[email protected]';
postData.user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:74.0) Gecko/20100101 Firefox/74.0';
postData.ip_address= '2607:f2c0:e34c:36b0:ac91:fd58:c9b7:7f03';
options.headers = {};
options.headers.X_API_SECRET_KEY = 'your_secret_key';
axios.post(endpoint, postData, options).then(function(response) {
  console.log(response.data);
}).catch(function(error) {
  console.error(error.response.data);
});

Python

import requests
url = 'https://api.zenlogin.co/v1/applications/appl0123456789/logins/checks'
postData = {
  'identity_key': 'usr12345',
  'identity_email_address': '[email protected]',
  'user_agent': 'Mozilla/5.0 (Windows NT 6.1; rv:74.0) Gecko/20100101 Firefox/74.0',
  'ip_address': '2607:f2c0:e34c:36b0:ac91:fd58:c9b7:7f03'
}
headers = {'X_API_SECRET_KEY': 'your_secret_key'}
response = requests.post(url, data=postData, headers=headers)
print response.content

Ruby

require 'uri'
require 'net/http'

uri = URI('https://api.zenlogin.co/v1/applications/appl0123456789/logins/checks')
req = Net::HTTP::Post.new(uri.path)
req['X_API_SECRET_KEY'] = 'your_secret_key'
postData = {}
postData['identity_key'] = 'usr12345'
postData['identity_email_address'] = '[email protected]'
postData['user_agent'] = 'Mozilla/5.0 (Windows NT 6.1; rv:74.0) Gecko/20100101 Firefox/74.0'
postData['ip_address'] = '2607:f2c0:e34c:36b0:ac91:fd58:c9b7:7f03'
req.set_form_data(postData);

https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true

response = https.request(req)
puts response.body