Laravel Passport에서 oauth2 서버를 만들고 타사 응용 프로그램에서 테스트하려고합니다. Oauth 서버는 Laravel을 사용하고 클라이언트는 Yii 프레임 워크를 사용합니다. 나는 클라이언트 프론트 엔드를 수정 할 수없는 그리고 난 OAuth를 서버에 요청을 전달하는 경로/API/OAuth를/로그인 생성 :Laravel Passport oauth/authorize가 기본 인증을 반환합니다.
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);
}
이 방법은 처리/API/OAuth를/콜백을 제공
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);
}
을
문서 에서처럼 모두 실현되었습니다. 하지만/api/oauth/login을 열면 oauth-server.loc/oauth/authorize? (params)로 리디렉션을 전달하면 http 기본 인증 창이 표시됩니다. WTF? Nginx에는 그러한 설정이 없습니다. 누군가 내가 뭘 잘못하고 있는지 알아? 도와주세요, 제발.
어제 yii (http://oauth2-client.thephpleague.com/providers/implementing/)에 opleh2 클라이언트를 설치했습니다. 그러나 결과는 같습니다. – epod
나는 똑같은 문제를 겪고있다. 해결책을 찾아 냈나요? @epod – kirgy