[Authclient] Azure AD

Dear forum members,

Since a couple of weeks i’m working with Yii2. I didn’t had any experience at all working with MVC frameworks, but i guess i understand the basics at this point.

I’m working on a web application were i have to make an SSO using Azure AD. After the authentication i have to push several documents to the clients Office 365 accounts using the SharePoint Online REST API. Does anybody know if i can use the authclient-extension for this?

I’m using Yii 2.0.3 and the latest authclient-extension.

Thank you

So far so good, i made a different client for Azure in authclient/clients. The endpoints i had to use were hard to find, but i finally got the good ones :rolleyes: .

I can now connect to the Azure endpoint and pass my Office 365 credentials. After the login, it redirects back to my Yii2 application with the following URL:

http://www.yii2build.com/site/auth?code=/AUTENTICATION CODE/&session_state=/SESSION STATE/

But the application is showing me a Not Found (#404).

Anybody got an idea what is going wrong here? I declared auth in the SiteController and i am using PrettyUrls

After looking trough the logs provided by the Yii debugger, i get the following error:




exception 'yii\web\NotFoundHttpException' in C:\wamp\www\yii2build\vendor\yiisoft\yii2-authclient\AuthAction.php:179

Stack trace:

#0 [internal function]: yii\authclient\AuthAction->run()

#1 C:\wamp\www\yii2build\vendor\yiisoft\yii2\base\Action.php(92): call_user_func_array(Array, Array)

#2 C:\wamp\www\yii2build\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\Action->runWithParams(Array)

#3 C:\wamp\www\yii2build\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('auth', Array)

#4 C:\wamp\www\yii2build\vendor\yiisoft\yii2\web\Application.php(83): yii\base\Module->runAction('site/auth', Array)

#5 C:\wamp\www\yii2build\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))

#6 C:\wamp\www\yii2build\frontend\web\index.php(18): yii\base\Application->run()

#7 {main}



So the following code can’t execute and throws an NotFoundHttpException error.




    public function run()

    {

        if (!empty($_GET[$this->clientIdGetParamName])) {

            $clientId = $_GET[$this->clientIdGetParamName];

            /* @var $collection \yii\authclient\Collection */

            $collection = Yii::$app->get($this->clientCollection);

            if (!$collection->hasClient($clientId)) {

                throw new NotFoundHttpException("Unknown auth client '{$clientId}'");

            }

            $client = $collection->getClient($clientId);


            return $this->auth($client);

        } else {

            throw new NotFoundHttpException();

        }

    }



Does anybody have an idea what i am doing wrong?

Could anybody please help me?

Hello, I have the same problem. Did anyone find the solution? Thanks!