Tokens

A token object is a LoginTC credential tied to a domain and user pair. The LoginTC credential lives on the LoginTC mobile app on the user's mobile device. See User Enrollment for more information.

Resources

PUT /domains/{domainId}/users/{userId}/token

Create a user domain token.

The token contains a state which may be either pending or active. When the token is pending it will also contain a 10-character code field which is the Activation Code that your user will enter in their LoginTC mobile app to load and activate the token.

Example

$ curl -X PUT https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38/token \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"' \
  -H 'Content-Length: 0'
{
    "state" : "pending",
    "code" : "d2mfr24l8r"
}
<?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);

// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';

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

// Helper function to create user domain token
$token = $logintc->createUserToken($domain_id, $user_id);

echo $token->getState();
# 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)

# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to create user domain token
token = client.create_user_token(domain_id, user_id)

print token['state']
// 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.Token;
 
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);

    // Domain id
    String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to create user domain token
    Token token = logintc.createUserToken(domainId, userId);

    System.out.println(token.getState());
  }
}

GET /domains/{domainId}/users/{userId}/token

Get user domain token information.

The code field will only be present when the token is in the pending state.

Example

$ curl -X GET https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38/token \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "state" : "pending",
    "code" : "d2mfr24l8r"
}
<?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);

// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';

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

// Helper function to get user domain token
$token = $logintc->getUserToken($domain_id, $user_id);

echo $token->getState();
# 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)

# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to get user domain token
token = client.get_user_token(domain_id, user_id)

print token['state']
// 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.Token;
 
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);

    // Domain id
    String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to get user domain token
    Token token = logintc.getUserToken(domainId, userId);

    System.out.println(token.getState());
  }
}

DELETE /domains/{domainId}/users/{userId}/token

Revoke a user domain token.

Revoking a token will prevent authentication attempts for that user and domain. Revoking a pending code will annul the Activation Code.

Example

$ curl -X DELETE https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38/token \
  -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);

// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';

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

// Helper function to delete user domain token
$logintc->deleteUserToken($domain_id, $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.LoginTC(api_key)

# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to delete user domain token
client.delete_user_token(domain_id, 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);

    // Domain id
    String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to delete user domain token
    logintc.deleteUserToken(domainId, userId);
  }
}