Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while sending HTTP request #1024

Closed
n1c01a5 opened this issue Jun 17, 2016 · 8 comments
Closed

Error while sending HTTP request #1024

n1c01a5 opened this issue Jun 17, 2016 · 8 comments

Comments

@n1c01a5
Copy link
Contributor

n1c01a5 commented Jun 17, 2016

After to go to http://localhost/app_dev.php/login/facebook I have this error :

Uncaught PHP Exception HWI\Bundle\OAuthBundle\OAuth\Exception\HttpTransportException: "Error while sending HTTP request" at /var/www/symfony/vendor/hwi/oauth-bundle/OAuth/ResourceOwner/AbstractResourceOwner.php line 256 Context: { "exception": "Object(HWI\\Bundle\\OAuthBundle\\OAuth\\Exception\\HttpTransportException)" } 

 [1/2] RequestException: Failed to connect to localhost port 1080: Connection refused  -

    in vendor/kriswallsmith/buzz/lib/Buzz/Client/Curl.php at line 29

My config_dev.php :

# HWIOAuthBundle
hwi_oauth:
    connect:
        account_connector: hwi_oauth.user.provider.entity
    firewall_names: [secured_area]
    resource_owners:
        facebook:
            type:                facebook
            client_id:           ...
            client_secret:       ...
            options:
                display: popup #dialog is optimized for popup window
                auth_type: rerequest # Re-asking for Declined Permissions
    fosub:
        username_iterations: 30
        properties:
            facebook: facebookId

My security.yml :

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

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        secured_area:
            anonymous: ~
            oauth:
                resource_owners:
                    facebook: "/login/check-facebook"
                login_path:        /login
                failure_path:      /login

                oauth_user_provider:
                    service: hwi_oauth.user.provider.entity

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, role: ROLE_ADMIN }

My User.php :

<?php

namespace CoreBundle\Entity;

use FOS\UserBundle\Model\User as FOSUBUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table
 * @ORM\Entity
 */
class User extends FOSUBUser
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(name="facebook_id", type="string", length=255, nullable=true)
     */
    private $facebookId;

    /**
     * @ORM\Column(name="github_id", type="string", length=255, nullable=true)
     */
    private $githubId;

    /**
     * @ORM\Column(name="google_id", type="string", length=255, nullable=true)
     */
    private $googleId;

    private $facebookAccessToken;

    /**
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param string $facebookId
     * @return User
     */
    public function setFacebookId($facebookId)
    {
        $this->facebookId = $facebookId;

        return $this;
    }

    /**
     * @return string
     */
    public function getFacebookId()
    {
        return $this->facebookId;
    }

    /**
     * @param string $facebookAccessToken
     * @return User
     */
    public function setFacebookAccessToken($facebookAccessToken)
    {
        $this->facebookAccessToken = $facebookAccessToken;

        return $this;
    }

    /**
     * @return string
     */
    public function getFacebookAccessToken()
    {
        return $this->facebookAccessToken;
    }

For information I use Symfony3.

Thanks for your help :)

@n1c01a5 n1c01a5 closed this as completed Jun 18, 2016
@maior-valentin
Copy link

No answer?

@ndziePatrickJoel
Copy link

Please can someone answer to this question?

@maior-valentin
Copy link

On my end I think the problem is due to the fact that my local in on HTTP while Google is on HTTPS. I realised this as my stage env is working properly.
SSL: certificate verification failed

@ndziePatrickJoel
Copy link

Thank you for responding.

NDZIE Patrick Joël

Software Engineer
Data Scientist
Advanced in Web and mobile developpement

R programming Certificat
https://www.coursera.org/account/accomplishments/certificate/LFQUB9EHA876

2016-08-23 13:51 GMT+01:00 Maior Valentin notifications@github.com:

On my end I think the problem is due to the fact that my local in on HTTP
while Google is on HTTPS. I realised this as my stage env is working
properly.
SSL: certificate verification failed


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1024 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AK5U4LZLBrmUagMMYiJH48BhnpUM2sP5ks5qiuzhgaJpZM4I4kc5
.

@dilipraya
Copy link

I am having the same problem. I am developing in localhost server, do I need ssl enabled server to use oauth logins?

@dilipraya
Copy link

dilipraya commented Mar 6, 2017

Add this in your hwi_oauth in your config.yml file.

    hwi_oauth:
          http_client:
              verify_peer: false

@augustinfla
Copy link

Why disable this check to make facebook connect works?
I have this problem but randomly ...

@tarry2009
Copy link

@augustinfla This is because of https / http difference. Google requests https. However it skips the https verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants