Hardware Tokens

Hardware tokens are devices which generate 6 or 8 digit codes periodically. They are associated with a user and can be used to access any domain in your organization.

Resources

POST /api/hardware

Create a hardware token.

Parameters

Name Description Required
alias A friendly name for the hardware token. No
serialNumber Associated serial number. Yes
type The type of hardware token. This can be TOTP6 or TOTP8. Yes
timeStep The length of time between each one-time password calculation. This can be 60s or 30s. Yes
seed The associated seed in hexadecimal format. Yes

Example

$ curl -X POST https://cloud.logintc.com/api/hardware \
  -d '{"type" : "TOTP6", "timeStep" : "60", "serialNumber" : "1000000000001", "seed" : "C5FC43FDD4BC215586A5283AD8296194E034AAE0"}' \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id":"d465336ff0ab256c0aa11d0444a49bc840c087f3",
    "alias":"HW-d465336f",
    "serialNumber":"1000000000001",
    "type":"TOTP6",
    "timeStep":"60s",
    "syncState":"Never Used",
    "user":""
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Hardware Token details
$alias = "john.doe token";
$serial_number = "1000000000001";
$type = "TOTP6";
$time_step = "60";
$seed = "C5FC43FDD4BC215586A5283AD8296194E034AAE0";

// Helper function to create hardware token
$hardware_token = $logintc->createHardwareToken($alias, $serial_number, $type, $time_step, $seed);

echo $hardware_token->getId();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# Hardware Token details
alias = 'john.doe token'
serial_number = '1000000000001'
type = 'TOTP6'
time_step = '60'
seed = 'C5FC43FDD4BC215586A5283AD8296194E034AAE0'

# Helper function to create hardware token
hardware_token = client.create_hardware_token(alias, serial_number, type, time_step, seed)

print hardware_token['id']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.HardwareToken;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Hardware Token details
    String alias = "john.doe token";
    String serialNumber = "1000000000001";
    String type = "TOTP6";
    String timeStep = "60";
    String seed = "C5FC43FDD4BC215586A5283AD8296194E034AAE0";

    // Helper function to create bypass code
    HardwareToken hardware_token = logintc.createHardwareToken(alias, serialNumber, type, timeStep, seed);

    System.out.println(hardware_token.getId());
  }
}

GET /api/hardware?page={page}

Get all hardware tokens.

Example

$ curl -X GET https://cloud.logintc.com/api/hardware?page=1 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
[
    {
    "id":"d465336ff0ab256c0aa11d0444a49bc840c087f3",
    "alias":"HW-d465336f",
    "serialNumber":"1000000000001",
    "type":"TOTP6",
    "timeStep":"60s",
    "syncState":"Never Used",
    "user":""
    }
]
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Page number
$page = 1;

// Helper function to get all hardware tokens
$hardware_tokens = $logintc->getHardwareTokens($page);

foreach( $hardware_tokens as $hardware_token ) {
  echo $hardware_token->getId();
}
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# Page number
page = 1

# Helper function to get all hardware tokens
hardware_tokens = client.get_hardware_tokens(page)

for hardware_token in hardware_tokens:
    print hardware_token['id']
// Get the library from github.com/logintc/logintc-java
import java.util.List;

import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.HardwareToken;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Page number
    Integer page = 1;

    // Helper function to get all hardware tokens
    List<HardwareToken> hardwareTokens = logintc.getHardwareTokens(page);

    for (HardwareToken hardwareToken : hardwareTokens) {
        System.out.println(hardwareToken.getId());
    }
  }
}

GET /api/hardware/{hardwareTokenId}

Get a specific hardware token.

Example

$ curl -X GET https://cloud.logintc.com/api/hardware/d465336ff0ab256c0aa11d0444a49bc840c087f3 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id":"d465336ff0ab256c0aa11d0444a49bc840c087f3",
    "alias":"HW-d465336f",
    "serialNumber":"1000000000001",
    "type":"TOTP6",
    "timeStep":"60s",
    "syncState":"Never Used",
    "user":""
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Hardware Token id
$hardware_token_id = "d465336ff0ab256c0aa11d0444a49bc840c087f3";

// Helper function to get a specific hardware token
$hardware_token = $logintc->getHardwareToken($hardware_token_id);

echo $hardware_token->getId();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# Hardware Token id
hardware_token_id = 'd465336ff0ab256c0aa11d0444a49bc840c087f3'

# Helper function to get a specific hardware token
hardware_token = client.get_hardware_token(hardware_token_id)

print hardware_token['id']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.HardwareToken;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Hardware Token id
    String hardwareTokenId = "d465336ff0ab256c0aa11d0444a49bc840c087f3";

    // Helper function to get a specific hardware token
    HardwareToken hardwareToken = logintc.getHardwareToken(hardwareTokenId);

    System.out.println(hardwareTokenId.getId());
  }
}

PUT /api/hardware/{hardwareTokenId}

Update a hardware token.

Example

$ curl -X PUT https://cloud.logintc.com/api/hardware/d465336ff0ab256c0aa11d0444a49bc840c087f3 \
  -d '{"alias" : "john.doe token"}' \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id":"d465336ff0ab256c0aa11d0444a49bc840c087f3",
    "alias":"john.doe token",
    "serialNumber":"1000000000001",
    "type":"TOTP6",
    "timeStep":"60s",
    "syncState":"Never Used",
    "user":""
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Hardware Token details
$hardware_token_id = "d465336ff0ab256c0aa11d0444a49bc840c087f3";
$alias = "john.doe token";

// Helper function to update a hardware token
$hardware_token = $logintc->updateHardwareToken($hardware_token_id, $alias);

echo $hardware_token->getAlias();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# Hardware Token details
hardware_token_id = 'd465336ff0ab256c0aa11d0444a49bc840c087f3'
alias = 'john.doe token'

# Helper function to update a hardware token
hardware_token = client.update_hardware_token(hardware_token_id, alias)

print hardware_token['alias']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.HardwareToken;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Hardware Token details
    String hardwareTokenId = "d465336ff0ab256c0aa11d0444a49bc840c087f3";
    String alias = "john.doe token";

    // Helper function to update a hardware token
    HardwareToken hardwareToken = logintc.updateHardwareToken(hardwareTokenId, alias);

    System.out.println(hardwareToken.getAlias());
  }
}

DELETE /api/hardware/{hardwareTokenId}

Delete a hardware token.

Example

$ curl -X DELETE https://cloud.logintc.com/api/hardware/d465336ff0ab256c0aa11d0444a49bc840c087f3 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Hardware Token id
$hardware_token_id = "d465336ff0ab256c0aa11d0444a49bc840c087f3";

// Helper function to delete a hardware token
$logintc->deleteHardwareToken($hardware_token_id);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Hardware Token id
hardware_token_id = 'd465336ff0ab256c0aa11d0444a49bc840c087f3'

# Helper function to delete a hardware token
client.delete_hardware_token(hardware_token_id)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Hardware Token id
    String hardwareTokenId = "d465336ff0ab256c0aa11d0444a49bc840c087f3";

    // Helper function to delete a hardware token
    logintc.deleteHardwareToken(hardwareTokenId);
  }
}

PUT /api/users/{userId}/hardware/{hardwareTokenId}

Associate a hardware token with a user.

Example

$ curl -X PUT https://cloud.logintc.com/api/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38/hardware/d465336ff0ab256c0aa11d0444a49bc840c087f3 \
  -d '' \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User id
$user_id = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

// Hardware Token id
$hardware_token_id = "d465336ff0ab256c0aa11d0444a49bc840c087f3";

// Helper function to associate a hardware token with a user
$logintc->associateHardwareToken($user_id, $hardware_token_id);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Hardware Token id
hardware_token_id = 'd465336ff0ab256c0aa11d0444a49bc840c087f3'

# Helper function to associate a hardware token with a user
client.associate_hardware_token(user_id, hardware_token_id)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Hardware Token id
    String hardwareTokenId = "d465336ff0ab256c0aa11d0444a49bc840c087f3";

    // Helper function to associate a hardware token with a user
    logintc.associateHardwareToken(userId, hardwareTokenId);
  }
}

GET /api/users/{userId}/hardware

Get the hardware token associated with a user.

Example

$ curl -X GET https://cloud.logintc.com/api/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38/hardware \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id":"d465336ff0ab256c0aa11d0444a49bc840c087f3",
    "alias":"HW-d465336f",
    "serialNumber":"1000000000001",
    "type":"TOTP6",
    "timeStep":"60s",
    "syncState":"Never Used",
    "user":""
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User id
$user_id = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

// Helper function to get a user's hardware token
$hardware_token = $logintc->getUserHardwareToken($user_id);

echo $hardware_token->getId();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to get a user's hardware token
hardware_token = client.get_user_hardware_token(user_id)

print hardware_token['id']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.HardwareToken;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to get a user's hardware token
    HardwareToken hardwareToken = logintc.getUserHardwareToken(userId);

    System.out.println(hardwareToken.getId());
  }
}

DELETE /api/users/{userId}/hardware

Disssociate the user’s hardware token.

Example

$ curl -X DELETE https://cloud.logintc.com/api/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38/hardware \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// User id
$user_id = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

// Helper function to disassociate a hardware token with a user
$logintc->disassociateHardwareToken($user_id);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = LoginTC(api_key)

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to disassociate a hardware token with a user
client.disassociate_hardware_token(user_id)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to disassociate a hardware token with a user
    logintc.disassociateHardwareToken(userId);
  }
}