Yubico / php-u2flib-server

(OBSOLETE) U2F library in PHP
https://developers.yubico.com/php-u2flib-server/
BSD 2-Clause "Simplified" License
288 stars 68 forks source link

Examples not working #21

Closed mondul closed 9 years ago

mondul commented 9 years ago

I'm trying to build a simple login site with a U2F device. Tested it on https://demo.yubico.com/u2f and works fine, but when I try to run both examples locally I get these errors:

For localstorage I get a HTML error 500 after the register POST; checking on the apache error log I got:

[Thu Apr 23 14:24:39.083298 2015] [:error] [pid 17385] [client 127.0.0.1:50108] PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message '$registrations of getRegisterData() method only accepts array.' in /home/www/Sites/u2f/u2flib_server/U2F.php:103\nStack trace:\n#0 /home/www/Sites/u2f/index.php(83): u2flib_server\\U2F->getRegisterData(NULL)\n#1 {main}\n  thrown in /home/www/Sites/u2f/u2flib_server/U2F.php on line 103, referer: http://u2f.local/

And for the pdo I get an alert with the message: "registration failed with errror: 2". Checking the db it inserts the entry on the users table but nothing on the registrations one.

I'd like to know if I'm missing something.

Thanks.

EDIT: Tested with https and changed the .local for .com on the virtualhost and /etc/hosts, now it shows the "security key access requested" modal and works fine. It seems the U2F extension is not custom-domain-friendly.

Please close the issue.

minisu commented 9 years ago

It seems the U2F extension is not custom-domain-friendly.

Yes, U2F specifies that web origins must have a top-level domain.