Skip to content

A modern PHP library for verifying Yubico One-Time Passwords.

Notifications You must be signed in to change notification settings

bulldogcreative/yubico

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Yubico auth

A modern PHP library for verifying Yubico One-Time Passwords.

Installation

This library can be found on Packagist. The recommended way to install this is through composer.

composer require bulldog/yubico

Usage

We include Guzzle by default, but you are welcome to use any other PHP HTTP client. You will need to create a new adapter for any other PHP HTTP client and have it implement the OtpAdapterInterface.

<?php
include 'vendor/autoload.php';

use Bulldog\Yubico\Yubico;
use Bulldog\Yubico\Adapters\GuzzleAdapter;

$yubico = new Yubico('1234', 'c2VjcmV0X2tleQ==', new GuzzleAdapter());

if($yubico->verify('longonetimepasswordgeneratedfromayubicokey')) {
    echo "That OTP is good!\n";
} else {
    echo "OTP is bad!\n";
    echo $yubico->getReason() . "\n";
}

About

A modern PHP library for verifying Yubico One-Time Passwords.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages