php – Can't get return from Azure authentication using magium active directory-ThrowExceptions

Exception or error:

I’m authenticating on an Azure application using a PHP script and function from a library called magium/active directory. The login process happens flawlessly when I call the “authenticate” method. This method is supposed to return an “entity” object containing information about the user which is logged in (e.g: name).

public function doLogin() {
     session_start();
     $request = \Zend\Psr7Bridge\Psr7ServerRequest::fromZend(new \Zend\Http\PhpEnvironment\Request())
     $ad = new \Magium\ActiveDirectory\ActiveDirectory(
            new \Magium\Configuration\Config\Repository\ArrayConfigurationRepository($this->config),
            $request)
        );
     $entity = $ad->authenticate();
}

However, if I try to get this entity object after the authentication line and “echo” it, nothing happens. If I try to write it to a database, nothing happens as well. If I try to store the value in session, it does not stay there (maybe the session is being refreshed by the lib?).

$entity = $ad->authenticate();
dd($entity); //this line does not seem to be called

It seems like the execution is being stopped and anything below the “authenticate” method call is being ignored. Has anyone ever experienced something like this?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *