Colleagues, faced with such a problem. Installed Laravel passport. Changing the front on the client (client on Yii) is not available to me, so I created a route for testing (let's call it / api / oauth / login), from which I redirect to the oauth-server:
public function actionOauthLogin() { $query = http_build_query([ 'client_id' => '12', 'client_secret' => '', 'redirect_uri' => 'http://client.loc/api/oauth/callback', 'response_type' => 'code', 'scope' => '', ]); return $this->redirect('http://oauth-server.loc/oauth/authorize?' . $query); } According to the route / api / oauth / callback, the following code (strictly according to the dock):
public function actionOauthCallback() { $http = new Client(); $response = $http->post('http://oauth-server.loc/oauth/token', [ 'form_params' => [ 'grant_type' => 'authorization_code', 'client_id' => '3', 'client_secret' => 'TJDyfygkuga45rtyfj8&65567Yhhgjjjj', 'redirect_uri' => 'http://client.loc/api/oauth/callback', 'code' => Yii::app()->request->getParamFromRequest('code'), ], ]); return json_decode((string) $response->getBody(), true); } And when I go to urla / api / oauth / login I am expectedly thrown over to oauth-server.loc / oauth / authorize? {Parameters} but the basic auth window appears there. Where it comes from and why is it not clear. In the nginx settings, no basic auth is configured. Well, if I click "cancel" in the basic authorization window, then oauth-server returns an error:
{"error":"invalid_client","message":"Client authentication failed"} Question: what am I doing wrong and how should it be?