Web application authentication with PHP

Hi community! I’m trying to add Duo Authentication to my PHP web app. I have “tried” to follow the documentation for the SDK under PHP, but none of the example/demo files work for me.

Is there any sample code out there that anyone has used that you could recommend? I’m not trying to do anything fancy, just present the authentication screen, and capture a session variable that says you authenticated.

Thanks in advance.

Hello, Looking for similar info. Did you get it to work?

The demo project in duo_universal_php/example at main · duosecurity/duo_universal_php · GitHub didn’t work for you?


When i copy the example folder to my test xampp server and run index.php i get error that ‘/vendor/autoload.php’ in not found, and there is no such file in this example.


I believe that gets added by composer? Did you run composer to get the demo requirements? I’m sorry to say I am not a PHP person…

Php scripts dont need compiling or similar, just php server and they should work.

True, that’s just how we made the Duo PHP example app work with our chosen web framework.

The example application provided demonstrates how to use the Duo client from an already-existing web application that already has authentication capabilities. It does not represent an entire authentication module that can simply be dropped in place.

I hope that information helps.

So far i havent managed to get this sample code to work unfortunately. Perhaps someone has more basic example, where main auth is hard coded into pre filled variables, and example code does mfa with it?