This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"evidence": { | |
"account_integrity": {...}, | |
"addresses": [...], | |
"device_behavior_reputation": "allowed", | |
"device_fraud_reputation": "allowed", | |
"device_integrity": { | |
"emulator": false, | |
"from_official_store": true, | |
"gps_spoofing": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
require 'json' | |
module Incognia | |
class Api | |
include Singleton | |
API_HOST = 'https://api.us.incognia.com/api/'.freeze | |
def register_login(installation_id:, account_id:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# login_form.rb | |
class LoginForm < BaseForm | |
attr_accessor :email, :password, :incognia_installation_id | |
validates :email, :password, presence: true | |
validate :device_risk | |
# Other validations... | |
def submit | |
return nil if invalid? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sessions_controller.rb | |
class SessionsController < ApplicationController | |
def create | |
@login_form = LoginForm.new(params) | |
if @user = @login_form.submit | |
sign_in @user | |
redirect_to @user, notice: "Welcome!" | |
else | |
render action: :new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ICGIncognia getInstallationId:^(NSString *installationId) { | |
if (installationId != nil) { | |
// NSURLRequest | |
[request setValue:installationId forHTTPHeaderField:@"Incognia-Installation-ID"]; | |
} | |
// Send the request with the installationId to your backend server | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Incognia.getInstallationId(context, new IncogniaListener<String>() { | |
@Override | |
public void onResult(final Result<String> result) { | |
if (result.isSuccessful()) { | |
String installationId = result.getResult(); | |
// HttpURLConnection | |
httpUrlConnection.setRequestProperty("Incognia-Installation-ID", installationId); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Incognia.getInstallationId(context) { result -> | |
if (result.isSuccessful) { | |
val installationId = result.result | |
// HttpURLConnection | |
httpUrlConnection.setRequestProperty("Incognia-Installation-ID", installationId) | |
} | |
// Send the request with the installationId to your backend server | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
const apiKey = process.env.ZIPCODE_API_KEY || "hkCt1nW1wF1rppaEmoor7T9G4ta7R5wFSu8l1dokNz8y53gGZHDneWWVosbEYirC"; | |
const zipCodeURL = 'https://www.zipcodeapi.com/rest/'; | |
var distance = { | |
find: function(req, res, next) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var properties = required('../package.json'); | |
var distance = require('../service/distance'); | |
var controllers = { | |
about: function(req,res){ | |
var aboutInfo = { name:properties.name, version: properties.version } | |
res.json(aboutInfo); | |
}, | |
get_distance: function(req, res){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var controller = require('./controller'); | |
module.exports = function(app) { | |
app.route('/about') | |
.get(controller.about); |