-
Notifications
You must be signed in to change notification settings - Fork 4
Token
enygma edited this page Apr 19, 2013
·
2 revisions
A Token type of Devices represents a hardware device/token attached to the account. The Duo Security API currently supports 4 token types:
- h6: HOTP-6 hardware token
- h8: HOTP-8 hardware token
- yk: YubiKey AES hardware token
- d1: Duo-D100 hardware token
Properties:
- type (Ex. "h6", "h8", "yk", "d1")
- serial
- secret
- aes_key
- token_id (internal ID)
Methods:
As with User you can use the find and findAll to get device details:
<?php
$token = new \DuoAuth\Devices\Token();
$tokens = $token->findAll();
// or just one
$tokenDetail = $phone->find($tokenId);
?>To create a new Token, you'll need to use the object for the type. For example, to make a Yubikey token and save it, you'd use:
<?php
$token = new \DuoAuth\Devices\Tokens\Yubikey();
$token->serial = '123abc';
$token->private_id = '9cbbb9e99e9d';
$token->aes_key = 'b121e523488bf8b9d23064b121e52348';
$token->save();
?>And delete the Token:
<?php
$token = new \DuoAuth\Devices\Token();
$token->findById('existing-token-id');
$token->delete();
?>