Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SSLRead()为Linkedin实现FOSUserBundle&HWIOauthBundle时返回错误_Php_Symfony_Oauth_Fosuserbundle_Hwioauthbundle - Fatal编程技术网

Php SSLRead()为Linkedin实现FOSUserBundle&HWIOauthBundle时返回错误

Php SSLRead()为Linkedin实现FOSUserBundle&HWIOauthBundle时返回错误,php,symfony,oauth,fosuserbundle,hwioauthbundle,Php,Symfony,Oauth,Fosuserbundle,Hwioauthbundle,我正在为HWIOAuthBundle设置配置,以允许用户使用其LinkedIn帐户登录。FOSUSerBundle也用于此项目。我遵循了这两个教程:和,在第29行的/Users/me/Sites/MyProject/vendor/kriswallsmith/buzz/lib/buzz/Client/Curl.php中得到了错误消息:SSLReat return error-9806 事实上,我已经获得了Linkedin访问令牌,但不知道为什么无法获得用户的个人资料 以下是我的配置: config

我正在为HWIOAuthBundle设置配置,以允许用户使用其LinkedIn帐户登录。FOSUSerBundle也用于此项目。我遵循了这两个教程:和,在第29行的/Users/me/Sites/MyProject/vendor/kriswallsmith/buzz/lib/buzz/Client/Curl.php中得到了错误消息:SSLReat return error-9806

事实上,我已经获得了Linkedin访问令牌,但不知道为什么无法获得用户的个人资料

以下是我的配置:

config.yml

imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }

hwi_oauth:
    connect:
        confirmation: true
        account_connector: my_user_provider

    firewall_name: main
    resource_owners:
        linkedin:
             type: linkedin
             client_id: "MY_API_KEY"
             client_secret: "MY_SECRET_KEY"
             scope: r_fullprofile
    fosub:
        username_iterations: 30
        properties:
             linkedin: linkedin_id

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: MyProject\UserBundle\Entity\User
    registration:
        form:
            type: myproject_user_registration
        confirmation:
            enabled: false
security.yml

security:
encoders:
    FOS\UserBundle\Model\UserInterface: sha512

role_hierarchy:
    ROLE_ADMIN:                ROLE_USER
    ROLE_SUPER_ADMIN:          ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username_email

firewalls:
    dev:
        pattern:  ^/(_(profiler|wdt)|css|images|js)/
        security: false

    admin:
        switch_user:        true
        pattern:            /admin(.*)
        form_login:
            provider:       fos_userbundle
            login_path:     /admin/login
            use_forward:    false
            check_path:     /admin/login_check
            failure_path:   null
            use_referer:    true
        anonymous:    true
        logout:
            path:           /admin/logout
            target:         /admin/login

    main:
        pattern: ^/

        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
            login_path: /login
            check_path: /login_check

        oauth:
            login_path:        /connect
            failure_path:      /connect
            #check_path:        /login_check
            #provider: fos_userbundle
            resource_owners:
                linkedin:     "/login/check-linkedin"
            oauth_user_provider:
                service: my_user_provider

        logout:
            path:       /logout
            target:     /connect

        anonymous: ~
        remember_me:
            key:      %secret%
            lifetime: 7776000
            path:     /
            domain:   ~
        switch_user: { role: ROLE_ADMIN }

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: %login_channel% }
    - { path: ^/login_check, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/connect, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register/confirmed, role: ROLE_USER }
    - { path: ^/register, role: ROLE_ADMIN, requires_channel: %register_channel% }
    - { path: ^/reset-password, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/_fragment, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }
    - { path: ^/, role: ROLE_USER }

parameters:
    security.exception_listener.class: MyProject\UserBundle\Security\Firewall\ExceptionListener
service.yml

services:
    my_user_provider:
        class: MyProject\UserBundle\Security\Core\User\FOSUBUserProvider
        arguments: [@fos_user.user_manager,{linkedin: linkedin_id }]
路由.yml

hwi_oauth_security:
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
    prefix: /connect

hwi_oauth_connect:
    resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
    prefix: /connect

hwi_oauth_redirect:
    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
    prefix:   /connect

linkedin_login:
    pattern: /login/check-linkedin

fos_user_security:
    resource: @FOSUserBundle/Resources/config/routing/security.xml

fos_user_profile:
    resource: @FOSUserBundle/Resources/config/routing/profile.xml
    prefix: /account/profile

fos_user_register:
    resource: @FOSUserBundle/Resources/config/routing/registration.xml
    prefix: /register

fos_user_resetting:
    resource: @FOSUserBundle/Resources/config/routing/resetting.xml
    prefix: /reset-password

fos_user_change_password:
    resource: @FOSUserBundle/Resources/config/routing/change_password.xml
    prefix: /account

fos_user_group:
    resource: @FOSUserBundle/Resources/config/routing/group.xml
    prefix: /group
我试图调试出了什么问题,var_转储LinkedinResourceOwner对象:

object(HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\LinkedinResourceOwner)[572]
protected 'paths' => 
  array (size=5)
    'identifier' => string 'id' (length=2)
    'nickname' => string 'formattedName' (length=13)
    'realname' => string 'formattedName' (length=13)
    'email' => string 'emailAddress' (length=12)
    'profilepicture' => string 'pictureUrl' (length=10)
protected 'options' => 
  array (size=11)
    'csrf' => boolean true
    'user_response_class' => string 'HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse' (length=54)
    'auth_with_one_url' => boolean false
    'use_commas_in_scope' => boolean false
    'use_bearer_authorization' => boolean false
    'authorization_url' => string 'https://www.linkedin.com/uas/oauth2/authorization' (length=49)
    'access_token_url' => string 'https://www.linkedin.com/uas/oauth2/accessToken' (length=47)
    'infos_url' => string 'https://api.linkedin.com/v1/people/~:(id,formatted-name,email-address,picture-url)?format=json' (length=94)
    'client_id' => string 'MY_API_KEY' (length=14)
    'client_secret' => string 'MY_SECRET_KEY' (length=16)
    'scope' => string 'r_fullprofile' (length=13)
protected 'httpClient' => 
  object(Buzz\Client\Curl)[577]
    private 'lastCurl' => resource(582, curl)
    protected 'options' => 
      array (size=2)
        181 => int 3
        182 => int 3
    protected 'ignoreErrors' => boolean true
    protected 'maxRedirects' => int 5
    protected 'timeout' => int 5
    protected 'verifyPeer' => boolean true
    protected 'proxy' => null
protected 'name' => string 'linkedin' (length=8)
protected 'state' => null
protected 'storage' => 
  object(HWI\Bundle\OAuthBundle\OAuth\RequestDataStorage\SessionStorage)[573]
    private 'session' => 
      object(Symfony\Component\HttpFoundation\Session\Session)[77]
        protected 'storage' => 
          object(Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage)[71]
            ...
        private 'flashName' => string 'flashes' (length=7)
        private 'attributeName' => string 'attributes' (length=10)
public 'httpUtils' => 
  object(Symfony\Component\Security\Http\HttpUtils)[17]
    private 'urlGenerator' => 
      object(Symfony\Bundle\FrameworkBundle\Routing\Router)[14]
        private 'container' => 
          object(appDevDebugProjectContainer)[271]
            ...
        protected 'matcher' => 
          object(appDevUrlMatcher)[615]
            ...
        protected 'generator' => null
        protected 'context' => 
          object(Symfony\Component\Routing\RequestContext)[13]
            ...
        protected 'loader' => null
        protected 'collection' => null
        protected 'resource' => string '/Users/zoe/Sites/jsr/app/cache/dev/assetic/routing.yml' (length=54)
        protected 'options' => 
          array (size=12)
            ...
        protected 'logger' => null
    private 'urlMatcher' => 
      object(Symfony\Bundle\FrameworkBundle\Routing\Router)[14]
        private 'container' => 
          object(appDevDebugProjectContainer)[271]
            ...
        protected 'matcher' => 
          object(appDevUrlMatcher)[615]
            ...
        protected 'generator' => null
        protected 'context' => 
          object(Symfony\Component\Routing\RequestContext)[13]
            ...
        protected 'loader' => null
        protected 'collection' => null
        protected 'resource' => string '/Users/me/Sites/MyProject/app/cache/dev/assetic/routing.yml' (length=54)
        protected 'options' => 
          array (size=12)
            ...
        protected 'logger' => null

我也有同样的问题,但是谷歌。你找到解决办法了吗?嘿,我今天也有同样的问题。我通过将CURLOPT_HTTP_VERSION curl选项从curl_HTTP_VERSION_1_0更改为curl_HTTP_VERSION_1_1来修复它。HWIOAuthBundle可以通过标题自动定义此选项。