Code Monkey home page Code Monkey logo

Comments (4)

ernestre avatar ernestre commented on July 19, 2024

Hi,
I've updated symfony to 2.8.* and it works fine on my end. You can checkout the 2.8 branch https://github.com/ernestre/Symfony-FOSUserBundle-HWIOAuthBundle/tree/symfony_2.8

Tell me if you still have issues. :)

from symfony-fosuserbundle-hwioauthbundle.

malinconico avatar malinconico commented on July 19, 2024

Thanks Ernest.
Work good on 2.8

last question : I cannot retrieve the email using $response->getEmail()
It’s a null value. I’ve well specified scope : "email » in config.yml.
any idea ?

$username = $response->getUsername();
$email = $response->getEmail();

    $user = $this->userManager->findUserBy(array($this->getProperty($response) => $username));
    //when the user is registrating
    if (null === $user) {
        $service = $response->getResourceOwner()->getName();
        $setter = 'set'.ucfirst($service);
        $setter_id = $setter.'Id';
        $setter_token = $setter.'AccessToken';
        // create new user here
        $user = $this->userManager->createUser();
        $user->$setter_id($username);
        $user->$setter_token($response->getAccessToken());
        //I have set all requested data with the user's username
        //modify here with relevant data
        $user->setUsername($username);
        $user->setEmail($email);
        $user->setPassword($username);
        $user->setEnabled(true);
        $this->userManager->updateUser($user);
        return $user;
    }

Thanks

Le 20 mai 2016 à 23:20, Ernest [email protected] a écrit :

Hi,
I've updated symfony to 2.8.* and it works fine on my end. You can checkout the 2.8 branch https://github.com/ernestre/Symfony-FOSUserBundle-HWIOAuthBundle/tree/symfony_2.8 https://github.com/ernestre/Symfony-FOSUserBundle-HWIOAuthBundle/tree/symfony_2.8
Tell me if you still have issues. :)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #1 (comment)

from symfony-fosuserbundle-hwioauthbundle.

ernestre avatar ernestre commented on July 19, 2024

You need to add
infos_url: "https://graph.facebook.com/me?fields=<your required fields>"
in the config.yml at the resource_owners.

It should look something like this:

resource_owners:
        facebook:
            type:                facebook
            client_id:           "%facebook_client_id%"
            client_secret:       "%facebook_client_secret%"
            scope:               "email"
            infos_url:           "https://graph.facebook.com/me?fields=id,last_name,first_name,email,picture.type(square)"

Using this url, response object will have the user's facebook id, name, last name, email and profile picture. To generate your own infos_url, see this for reference : https://developers.facebook.com/tools/explorer/

from symfony-fosuserbundle-hwioauthbundle.

malinconico avatar malinconico commented on July 19, 2024

Perfect thanks

Le 21 mai 2016 à 19:18, Ernest [email protected] a écrit :

scope: "email"
infos_url: "https://graph.facebook.com/me?fields=id,last_name,first_name,email,picture.type(square) https://graph.facebook.com/me?fields=id,last_name,first_name,email,picture.type(square)"

from symfony-fosuserbundle-hwioauthbundle.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.