Skip to content

Instantly share code, notes, and snippets.

View lkdocs's full-sized avatar

LaunchKey Documentation Examples lkdocs

View GitHub Profile
@lkdocs
lkdocs / Ruby Auth Flow: Decrypt and Verify User Response Example.rb
Created April 17, 2015 17:16
Ruby Auth Flow: Auth Callbackl Example
LaunchKey.authorized?(auth)
@lkdocs
lkdocs / Python Auth Flow: Auth Callback Example.py
Created April 17, 2015 17:15
Python Auth Flow: Auth Callback Example
api.is_authorized(auth_request, auth)
@lkdocs
lkdocs / Ruby: Create White Label User.rb
Created April 3, 2015 00:24
Ruby: Create White Label User
LaunchKey.create_whitelabel_user(identifier)
@lkdocs
lkdocs / Python Auth Flow:Create White Label User.py
Created April 3, 2015 00:02
Python Auth Flow:Create White Label User
response = api.create_whitelabel_user("identifier")
@lkdocs
lkdocs / .NET: Create White Label User Example.cs
Created April 2, 2015 23:54
.NET: Create White Label User Example
var whiteLabelUser = client.CreateWhiteLabelUser("identifier");
@lkdocs
lkdocs / Java SDK: Create White Label User Example.java
Last active August 29, 2015 14:18
Java SDK: Create White Label User Example
try {
WhiteLabelUserCreateResult result =
authenticationManager.createWhiteLabelUser(myUniqueUserIdentifier);
}
catch(AuthenticationException e) {
//error handling
}
@lkdocs
lkdocs / LaunchKey PHP SDK - DeOrbit.php
Last active August 29, 2015 14:18
LaunchKey PHP SDK - DeOrbit
$client->auth()->deOrbit("AuthRequestID");
@lkdocs
lkdocs / LaunchKey PHP SDK - Add Logger - Monolog.php
Created April 1, 2015 19:55
LaunchKey PHP SDK - Add Logger - Monolog
$logger = new \Monolog\Logger('launchkey', new \Monolog\Handler\ErrorLogHandler());
$config = new \LaunchKey\SDK\Config();
$config->setAppKey("1234567890")
->setSecretKey("supersecretandwayrandomsecretkey")
->setPrivateKeyLocation("/usr/local/etc/launchkey-app-private-key.pem")
->setLogger($logger);
$client = \LaunchKey\SDK\Client::factory($config);
@lkdocs
lkdocs / LaunchKey PHP SDK - Create White Label User.php
Created April 1, 2015 18:34
LaunchKey PHP SDK - Create White Label User
$user = $client->whiteLabel()->createUser("PermanentUniqueIdentifier");
@lkdocs
lkdocs / LaunchKey PHP SDK - Event Subscription.php
Last active August 29, 2015 14:18
LaunchKey PHP SDK - Event Subscription
$client->eventDispatcher()->subscribe(
\LaunchKey\SDK\Event\AuthResponseEvent::NAME,
function (authResponseEvent) {
$authorized = $authResponseEvent->getAuthResponse()->isAuthorized();
if ($authorized !== null) {
$stat = "login." . $authorized ? 'authorized' : 'denied';
StatsD::getInstance()->increment($stat);
}
}
);