Need help with php-yubico?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

Yubico
133 Stars 45 Forks BSD 3-Clause "New" or "Revised" License 195 Commits 18 Opened issues

Description

PHP class for Yubico authentication

Services available

!
?

Need anything else?

Contributors list

== Auth_Yubico PHP class ==

NOTE: This project is deprecated and is no longer being maintained. For more information and guidance on how to implement Yubico OTP support in applications, see https://status.yubico.com/2021/04/15/one-api-yubico-com-one-http-get/.

The Yubico authentication PHP class provides an easy way to integrate the Yubikey into your existing PHP-based user authentication infrastructure. Installation is simple using PEAR.

The development community is co-ordinated via https://github.com/Yubico/php-yubico[the Github project].

=== Installation ===

Make sure your PHP installation supports curl, and that you have installed PEAR. On Debian/Ubuntu systems:

$ apt-get install libapache2-mod-php5 php5-curl php-pear

Install the component by invoking:

$ wget https://developers.yubico.com/php-yubico/Releases/AuthYubico-latest.tgz $ pear install AuthYubico-latest.tgz

=== Usage ===

NOTE: Make sure that you have read https://developers.yubico.com/OTP/Libraries/Usingalibrary.html[Using a YubiKey OTP library] before continuing.

This is an example of how you can use the

Yubico.php
inside an HTML *.php file:

[source, php]

<?php require_once 'Auth/Yubico.php'; $otp = "ccbbddeertkrctjkkcglfndnlihhnvekchkcctif";

# Generate a new id+key from https://upgrade.yubico.com/getapikey $yubi = new Auth_Yubico('42', 'FOOBAR='); $auth = $yubi->verify($otp); if (PEAR::isError($auth)) { print "

Authentication failed: " . $auth->getMessage(); print "

Debug output from server: " . $yubi->getLastResponse(); } else { print "

You are authenticated!"; }

?>

==== API demo

Provided in the package is also a script https://github.com/Yubico/php-yubico/blob/master/demo.php[demo.php] that demonstrates how you may use the package.

==== Example site There is also a complete example site that demonstrates one-factor and two-factor mode. It requires a database to store the username and passwords. Database schema is in https://github.com/Yubico/php-yubico/blob/master/example/db.sql[example/db.sql] and configuration for the database needs to go into https://github.com/Yubico/php-yubico/blob/master/example/config.php[example/config.php].

=== Modhex Calculator This package also includes https://github.com/Yubico/php-yubico/blob/master/example/ModhexCalculator.php[ModhexCalculator.php], a web page illustrating how to work with the modhex encoding. It is deployed https://demo.yubico.com/php-yubico/Modhex_Calculator.php[here]

=== License The project is licensed under a BSD license. See the file COPYING for exact wording. For any copyright year range specified as YYYY-ZZZZ in this package note that the range specifies every single year in that closed interval.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.