Check type of token.

Signed-off-by: crynobone <crynobone@gmail.com>