我希望任何人都可以回答我的以下问题。
我用 symgfony2 运行一个项目。我将为用户提供从 Linkedin 或 XING 等外部平台导入他们的简历。
我不需要的是让用户能够通过linkedin 或Xing 登录我的网站。
所以我虽然可以为此使用 HwioAuthBundle,但我不知道该怎么做!
目前是这样,我来到linkedin上的登录页面,但是当我回到我的网站时,我得到了错误:
"""
Controller "XXXXX\MyBundle\Controller\MyController::importProfileLinkedinAction()" requires that you provide a value for the "$response" argument (because there is no default value or because there is a non optional argument after this one).
"""
我按照文档中的说明进行操作:
配置.yml
hwi_oauth:
firewall_name: secured_area
resource_owners:
linkedin:
type: linkedin
client_id: XXXXXXXXXXXXXXXX
client_secret: XXXXXXXXXXXXXXXX
scope: r_fullprofile
infos_url: "http://api.linkedin.com/v1/people/~:(id,formatted
name,recommendations-received)"
services:
oauth_user_provider:
class: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider
安全.yml
secured_area:
oauth:
resource_owners:
linkedin: /login/linkedin
login_path: /secured/login
failure_path: /secured/login
oauth_user_provider:
oauth: ~
路由.yml
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /secured/connect
linkedin:
pattern: /login/linkedin
defaults:
_controller: MYBundle:MyController:importProfileLinkedin
MyController.php
use \HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
...
public function importProfileLinkedinAction(Request $request, UserResponseInterface $response)
{
$data = $response->getResponse(); /* this method should return all data that was sent from resource owner ???*/
var_dump(
$data
);
exit;
}
谢谢