davidearl / webauthn

An implementation of webauthn in PHP on the server side (e.g Yubico 2 and Google Titan keys)
https://webauthn.davidearl.uk
MIT License
129 stars 24 forks source link

500 / Couldn't initiate registration #57

Closed im-richard closed 1 year ago

im-richard commented 1 year ago

I've been dying to try this, but I've been plagued with an issue for over 5 hours now. After five hours of printing, debugging, switching servers, I'm here surrendering.

Installed your script + dependencies, and I am greeted with Couldn't initiate registration.

When I first installed, when I clicked registration, it actually printed my entire homepage in code. I went through your github issue list, and you mentioned something about the links and it looking in a specific folder.

So I moved things around, and finally got the error to disappear, and now the Couldn't initiate registration is my next issue.

https://i.imgur.com/FInE0AN.png

If I go into chrome developer tools; I notice it lists index.php with a 500 error for POST. I tried self hosting the .js on the same server running the script, thinking maybe something was blocking the external hosted file, and that did nothing.

I am indeed using Cloudflare, but I thought at one point maybe Cloudflare is blocking something with the request; so I actually disabled cloudflare and that did nothing.

https://i.imgur.com/puCffZo.png

I then finally got irritated enough to do a quick install of XAMPP via localhost and install the script.

It appeared to work fine and allowed me to create a user, I just receive Invalid Domain.

https://i.imgur.com/Zi3CSJl.png

Which is a heck of a lot more program than my official website

Any help would be amazing. I'm at a loss for words. I figured by disabling Cloudflare; if it was indeed cloudflare blocking the request for some reason; disabling it would address it, but nothing has changed.

Edit: Completely disabled Cloudflare; turned off HTTPS rewrite; nothing to do with that service whatsoever. Same error.

Regards

im-richard commented 1 year ago

Just an update. For anyone who stumbles across this later.

This issue had absolutely nothing to do with this script. It was something screwed up with the server. I spent hours checking raw logs, and gained no information at all.

I don't know quite "why", but I went into my server, and set the MultiPHP INI Editor files back to default, and then re-selected the items I needed (such as fopen); restarted apache / php, and for some unknown god forsaken reason, it started to work.

I don't know why, but 7 hours later I finally was able to register and then authenticate myself using my Yubikey.

davidearl commented 1 year ago

FWIW, it sounds like your Apache wasn't originally set up to run PHP, so just delivered it as text, like it would html.(The AddType directive, or the equivalent if you're using FPM). Your reset included that properly.

Glad your key now works.