Skip to content
This repository has been archived by the owner on Dec 17, 2022. It is now read-only.

Compatibility with Symfony 2.8 ? #1

Closed
malinconico opened this issue May 20, 2016 · 4 comments
Closed

Compatibility with Symfony 2.8 ? #1

malinconico opened this issue May 20, 2016 · 4 comments

Comments

@malinconico
Copy link

Hi,

thanks for this package, it work well.
Should it works the same on 2.8 ?
Because I've change to 2.8 the Symfony version on composer.json, but get some error on the page.

Thanks

@ernestre
Copy link
Owner

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. :)

@malinconico
Copy link
Author

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 notifications@github.com 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)

@ernestre
Copy link
Owner

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/

@malinconico
Copy link
Author

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

No branches or pull requests

2 participants