Using Hybridauth to get Yahoo email

26 views Asked by At

I am trying to use hybridauth for a "Continue with Yahoo" button. I create the app on Yahoo, and implemented the code on a similar way I have been using it for the other social networks. But the response of yahoo ony have the property "sub". I does not have name or email, or anything else.

Here is my code:

$configYahoo = [
    // Location where to redirect users once they authenticate with Yahoo
    // For this example we choose to come back to this same script
    'callback' => '**',

    "enabled" => true,
    // Yahoo application credentials
    'keys' => [
        'id' => '**',
        'secret' => '**'
    ],
    "scope"   => ['sdct-r', 'fspt-r', 'mail-r', 'sdps-r', 'sdpp-w'],
];

$adapterYahoo = new Hybridauth\Provider\Yahoo($configYahoo);
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

include 'controllers/utils-functions.php';

try {
    $adapterYahoo->authenticate();
    $userProfile = $adapterYahoo->getUserProfile();
    $isConnected = $adapterYahoo->isConnected();
    // var_dump($isConnected);
    // var_dump($userProfile);

    $adapterYahoo->disconnect();
    if ($userProfile->lastName) {
        $fullname = $userProfile->firstName . ' ' . $userProfile->lastName;
    } else {
        $fullname = $userProfile->firstName;
    }
?>

This is the response I get, I used var_dump to get it:

object(stdClass)#75 (1) { ["sub"]=> string(26) "******************" }

Please let me know if something like this happen to any of you guys, or if you notice what I am doing wrong, I don't know what else to try.

0

There are 0 answers