Skip to content

Instantly share code, notes, and snippets.

@tylerreinhart
tylerreinhart / gist:10781282
Created Apr 15, 2014
Toopher Ptyhon Example
View gist:10781282
import toopher
# Create an API object using your credentials
api = toopher.ToopherApi("<your consumer="" key="">", "<your consumer="" secret="">")
# Step 1 - Pair with their phone's Toopher app
pairing_status = api.pair("pairing phrase", "username@yourservice.com")
# Step 2 - Authenticate a log in
auth = api.authenticate(pairing_status.id, "my computer")
View toopher-python-pairing-example.py
import toopher
# Create an API object using your credentials
api = toopher.ToopherApi("<your consumer="" key="">", "<your consumer="" secret="">")
# Step 1 - Pair with their phone's Toopher app
pairing_status = api.pair("pairing phrase", "username@yourservice.com")
@tylerreinhart
tylerreinhart / toopher-python-authenticating-example.py
Created Apr 17, 2014
Toopher Python Authentication Example
View toopher-python-authenticating-example.py
import toopher
# Create an API object using your credentials
api = toopher.ToopherApi("<your consumer="" key="">", "<your consumer="" secret="">")
auth = api.authenticate(pairing_status.id, "my computer")
# Once they've responded you can then check the status
auth_status = api.get_authentication_status(auth.id)
if (auth_status.pending == false and auth_status.granted == true):
View toopher-ruby-pairing-example.rb
require 'toopher_api'
# Create an API object using your credentials
toopher = ToopherAPI.new("key", "secret")
# Step 1 - Pair with their phone's Toopher app
pairing = toopher.pair("pairing phrase", "username@yourservice.com")
View toopher-dotnet-pairing-example.cs
using Toopher;
// Create an API object using your credentials
ToopherApi api = new ToopherApi("<your consumer key>", "<your consumer secret>");
// Step 1 - Pair with their phone's Toopher app
PairingStatus pairing = api.Pair("pairing phrase", "username@yourservice.com");
@tylerreinhart
tylerreinhart / toopher-dotnet-authentication-example.cs
Created Apr 18, 2014
Toopher dotnet Authentication Example
View toopher-dotnet-authentication-example.cs
using Toopher;
// Create an API object using your credentials
ToopherApi api = new ToopherApi("<your consumer key>", "<your consumer secret>");
// Authenticate a log in
AuthenticationStatus auth = api.Authenticate(pairing.id, "my computer");
// Once they've responded you can then check the status
AuthenticationStatus status = api.GetAuthenticationStatus(auth.id);
View toopher-ruby-authentication-example.rb
require 'toopher_api'
# Create an API object using your credentials
toopher = ToopherAPI.new("key", "secret")
# Authenticate a log in
auth_status = toopher.authenticate(pairing.id, 'my computer')
# Once they've responded you can then check the status
while auth_status.pending
@tylerreinhart
tylerreinhart / toopher-get-pairing-json-response-example.js
Created Apr 18, 2014
Toopher Get Pairing JSON Response Example
View toopher-get-pairing-json-response-example.js
{
'pairing_request_id':'1abc2d34-e567-8ff9-ba27-df72f4e9818a',
'totp_length':6,
'created':'2013-06-11 23:59:59',
'enabled':True,
'modified':'2013-06-11 23:59:59',
'user':{
'name':'seth@toopher.com',
'created':'2013-06-11 23:59:59',
'id':'s374db3d-b269-45c6-8e83-2e647f52ba51',
View toopher-php-pairing-example.php
require_once("toopher_api.php");
// Create an API object using your credentials
$toopherApi = new ToopherAPI($key, $secret);
// Step 1 - Pair with their phone's Toopher app
$pairing = $toopherApi->pair("pairing phrase", "username@yourservice.com");
View toopher-java-pairing-example.java
import com.toopher.*;
// Create an API object using your credentials
ToopherApi api = new ToopherApi("<your consumer key>", "<your consumer secret>");
// Step 1 - Pair with their phone's Toopher app
PairingStatus pairing = api.pair("pairing phrase", "username@yourservice.com");