使用FOSOAuthServerBundle的登录表单

时间:2016-04-21 10:40:45

标签: php symfony

我正在尝试使用FOSOAuthServerBundle捆绑包在Symfony中设置OAuth服务器。但是,我收到以下错误:

  

未找到客户。

     

404 Not Found - NotFoundHttpException

据我所知,在源代码中,它正在某个地方寻找客户端。 (见下面的代码)

如何在表单中提供该信息?我试过放入隐藏的client_id字段但没有成功。

$request = $this->getCurrentRequest();

$client = null;
if (null !== $request) {
    if (null === $clientId = $request->get('client_id')) {
        $form = $this->container->get('fos_oauth_server.authorize.form');
        $formData = $request->get($form->getName(), array());
        $clientId = isset($formData['client_id']) ? $formData['client_id'] : null;
    }

    $client = $this->container
        ->get('fos_oauth_server.client_manager')
        ->findClientByPublicId($clientId);
}

if (null === $client) {
    throw new NotFoundHttpException('Client not found.');
}

1 个答案:

答案 0 :(得分:0)

It's expected to be in the URL. This worked out for me:

http://local.dev/oauth/v2/auth?client_id=1_123123123123

相关问题