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?

  • php artisan passport: client --password did that? - Orange_shadow
  • Yes, and in the table oauth_clients it is in the field password_client it has 1 - epod
  • Have you ever tried what they advise? stackoverflow.com/questions/39572957/… - Orange_shadow
  • Taak. Interestingly, Google did not spit it out to me. Now I will look, thanks! - epod
  • no, none of this helped. there was one oddity. On one single request, everything worked as it should, I was thrown on the authorization form. But after entering the login and password, the same crap started - epod

0