Skip to content

Instantly share code, notes, and snippets.

View lkdocs's full-sized avatar

LaunchKey Documentation Examples lkdocs

View GitHub Profile
@lkdocs
lkdocs / LaunchKey Node.js SDK - Instantiate Client.js
Last active August 29, 2015 14:18
LaunchKey Node.js SDK - Instantiate Client
var LaunchKey = require("launchkey-sdk"),
appKey = "1234567890",
secretKey = "qwertyuiodfghjklcvbnm",
privateKey = "-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----",
launchKey;
launchKey = new LaunchKey(appKey, secretKey, privateKey);
@lkdocs
lkdocs / LaunchKey Node.js SDK - Authenticate User.js
Last active August 29, 2015 14:18
LaunchKey Node.js SDK - Authenticate User
launchKey.authenticate(
"LaunchKeyUserName",
function (authRequest) {
console.log("Authentication request successful", authRequest);
},
function (error) {
console.error("Error processsing authentication request!", error);
}
);
@lkdocs
lkdocs / LaunchKey Node.js SDK - Authorize Transaction.js
Created March 30, 2015 22:19
LaunchKey Node.js SDK - Authorize Transaction
launchKey.authorize(
"LaunchKeyUserName",
function (authRequest) {
console.log("Authorization request successful", authRequest);
},
function (error) {
console.error("Error processsing authorization request!", error);
}
);
@lkdocs
lkdocs / LaunchKey Node.js SDK - AuthRequest Object.js
Created March 30, 2015 22:30
LaunchKey Node.js SDK - AuthRequest Object
var AuthRequest = require("launchkey-sdk").AuthRequest,
authRequest = new AuthRequest("auth request ID");
launchKey.deOrbit(authRequest);
@lkdocs
lkdocs / LaunchKey Node.js SDK - Create White Label User.js
Created March 31, 2015 00:16
LaunchKey Node.js SDK - Create White Label User
launchKey.createWhiteLabelUser(
identifier,
function (whiteLabelUser) {
cli.ok("User with identifier of \"" + identifier + "\" created with:");
cli.ok(" QR Code URL: " + whiteLabelUser.getQrCodeUrl());
cli.ok(" Code: " + whiteLabelUser.getCode());
},
error
);
@lkdocs
lkdocs / LaunchKey Node.js SDK - Is Authorized.js
Created March 30, 2015 23:41
LaunchKey Node.js SDK - Is Authorized
var AuthRequest = require("launchkey-sdk").AuthRequest,
authRequest = new AuthRequest("auth request ID")
error = function (error) {
console.error("Error encountered: [" + error.code + "] " + error.message);
};
launchKey.isAuthorized(
authRequest,
function () {
console.log("Request is still authorized");
@lkdocs
lkdocs / LaunchKey Node.js SDK - Check Status.js
Last active August 29, 2015 14:18
LaunchKey Node.js SDK - Check Status
var error = function (error) {
console.log("Error encountered: [" + error.code + "] " + error.message);
},
poll = function (authRequest) {
launchKey.checkStatus(
authRequest,
function (authRequest) {
console.log("User accepted launch request " + authRequest.getId());
},
function (authRequest) {
@lkdocs
lkdocs / LaunchKey Node.js SDK - DeOrbit.js
Created March 30, 2015 23:47
LaunchKey Node.js SDK - DeOrbit
var AuthRequest = require("launchkey-sdk").AuthRequest,
authRequest = new AuthRequest("auth request ID")
error = function (error) {
console.error("Error encountered: [" + error.code + "] " + error.message);
};
launchKey.deorbit(
authRequest,
function () {
console.log("Logged out " + authRequest.getId());
@lkdocs
lkdocs / LaunchKey PHP SDK - Create Client From Factory - Simple.php
Last active August 29, 2015 14:18
LaunchKey PHP SDK - Create Client From Factory - Simple
$client = \LaunchKey\SDK\Client::factory(
"1234567890",
"supersecretandwayrandomsecretkey",
file_get_contents("/usr/local/etc/launchkey-app-private-key.pem")
);
@lkdocs
lkdocs / LaunchKey PHP SDK - Create Client From Factory - Config.php
Created March 31, 2015 17:15
LaunchKey PHP SDK - Create Client From Factory - Config
$config = new \LaunchKey\SDK\Config();
$config->setAppKey("1234567890")
->setSecretKey("supersecretandwayrandomsecretkey")
->setPrivateKeyLocation("/usr/local/etc/launchkey-app-private-key.pem");
$client = \LaunchKey\SDK\Client::factory($config);