yos-social-php5
yos-social-php5 copied to clipboard
How to fetch private data through YQL?
How I can fetch private data through YQL with YahooYQLQuery class and execute()? As in the example, it only show fetching public data. The error that I received while fetching data is:
YQL query failed with error: "Authentication Error. The table social.contacts requires a higher security level than is provided, you provided ANY but at least USER is expected".
Thank you.
Same problem.
Are there any methods to debug this error? I'm experiencing the same issue after verifying that I gave myself correct r/w access.
Did any of you guys solve this? I'm experiencing the same problem. It works in yahoo's console since i am logged in (i guess), but it doesn't work in my own app, even though i've gone through the Oauth-process.
This script fetch data through YQL https://github.com/eugeniotcs/YQLQueryYahooapis/tree/master
Link update on 2016-09-20
Bye
Same question... did someone have working example of fetching private data through YQL?
For example:
<?php
YahooLogger::setDebug(false);
YahooLogger::setDebugDestination('LOG');
if ( empty($_COOKIE['language']) ) $_COOKIE['language'] = 'en';
require '../language/lang-'.$_COOKIE['language'].'.php';
if (isset($_GET['usermailfrom'])) $_SESSION['usermailfrom'] = $_GET['usermailfrom']; else $_SESSION['usermailfrom'] = '[email protected]';
$host = 'http://' . $_SERVER["HTTP_HOST"];
// check for the existance of a session.
// this will determine if we need to show a pop-up and fetch the auth url,
// or fetch the user's social data.
$hasSession = YahooSession::hasSession($_SESSION['consumer_key'], $_SESSION['consumer_secret'], $_SESSION['app_id']);
if ($hasSession == FALSE) {
// create the callback url use if you need
$callback = YahooUtil::current_url();
// pass the credentials to get an auth url.
// this URL will be used for the pop-up.
$auth_url = YahooSession::createAuthorizationUrl($_SESSION['consumer_key'], $_SESSION['consumer_secret'], $callback);
} else {
header("Location: $host/sites/all/libraries/invite-friends-yahoo/connected.php");
}
after this you can set session
if (isset($_GET['logout']) && $_GET['logout'] == 1) {
// if a session exists and the logout flag is detected
// clear the session tokens and reload the page.
YahooSession::clearSession();
unset($_SESSION['access_token']);
unset($_SESSION['access_token_secret']);
unset($_SESSION['access_token_consumer']);
unset($_SESSION['access_token_sessionhandle']);
unset($_SESSION['oauth_provider']);
unset($_SESSION['yahoouser']);
unset($_SESSION['consumer_key']);
unset($_SESSION['consumer_secret']);
unset($_SESSION['app_id']);
header("Location: $host/sites/all/libraries/invite-friends-yahoo/index.php");
}
See full code in repository @link https://github.com/eugeniotcs/YQLQueryYahooapis/tree/master
@Qmegas YQL still uses OAuth 1.0 for authentication, so I think authenticating your request to YQL with OAuth 1.0 token will work. Also, If you're working with social data by any chance, you are better working with Social Directory API (you can use OAuth 2.0 access tokens with it).