简体   繁体   English

使用FOSOAuthServerBundle的登录表单

[英]Using a login form for FOSOAuthServerBundle

I am trying to set up an OAuth server in Symfony using the FOSOAuthServerBundle bundle. 我正在尝试使用FOSOAuthServerBundle包在Symfony中设置OAuth服务器。 However, I am getting the following error: 但是,我收到以下错误:

Client not found. 找不到客户。

404 Not Found - NotFoundHttpException 找不到404 - NotFoundHttpException

As far as I can see in the source code, it is looking for a client somewhere. 据我所知,在源代码中,它正在某个地方寻找客户端。 (See code below) (见下面的代码)

How do I provide it with that information in the form? 如何在表单中提供该信息? I've tried putting in a hidden client_id field without any success. 我试过放入一个隐藏的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.');
}

It's expected to be in the URL. 它应该在URL中。 This worked out for me: 这对我有用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM