2016-11-29 7 views
0

私のクライアントでは、私は次のルートを使って認証トークンを取得しています。Laravel 5.3パスポートはhttp認証に尋ねます

Route::get('/redirect', function() { 
    $query = http_build_query([ 
     'client_id' => '1', 
     'redirect_uri' => 'http://localhost:8001/callback', 
     'response_type' => 'code', 
     'scope' => '' 
    ]); 

    return redirect('http://localhost:8000/oauth/authorize?'.$query); 
}); 


Route::get('/callback', function (Illuminate\Http\Request $request) { 
    $http = new \GuzzleHttp\Client; 

    $response = $http->post('http://localhost:8000/oauth/token', [ 
     'form_params' => [ 
      'client_id' => '1', 
      'client_secret' => 'secret-code', 
      'grant_type' => 'authorization_code', 
      'redirect_uri' => 'http://localhost:8001/callback', 
      'code' => $request->code, 
     ], 
    ]); 
    return json_decode((string) $response->getBody(), true); 
}); 

しかし、私がhttp://localhost:8001/redirectをブラウズすると、http認証が要求されます。認証が必要な理由と解決方法

enter image description here

答えて

0

は今日と同じ問題を抱えていた、と考え出す多くの時間を費やしました。

私は最終的に原因を見つけました。無効なクライアント(間違ったクライアントIDまたは間違った秘密鍵)を入力すると、PassportによってWWW-Authenticateヘッダーが返されたようです。

実際、私の資格情報に誤りがあり、問題を解決しました。

希望します。

関連する問題