我希望有人能回答我的问题如下。
我跑与symgfony2的项目。 我会提供给用户从外部plattforms像LinkedIn或XING导入他们的简历。
什么我不需要是为用户提供通过LinkedIn或兴登录到我的网站的能力。
所以,我虽然我可以使用这个HwioAuthBundle,但我不能弄清楚,如何做到这一点!
目前是这样的,我来loginpage在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).
“””
我这样做,如文档中所述:
config.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
security.yml
secured_area:
oauth:
resource_owners:
linkedin: /login/linkedin
login_path: /secured/login
failure_path: /secured/login
oauth_user_provider:
oauth: ~
使用routing.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;
}
谢谢