0

YahooSession::hasSession is not working out for me

    $hasSession = YahooSession::hasSession(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID);
    if($hasSession == FALSE) 
    {
// create the callback url,
$callback = YahooUtil::current_url()."?in_popup";
$sessionStore = new NativeSessionStore();
// pass the credentials to get an auth url.
// this URL will be used for the pop-up.
$auth_url = YahooSession::createAuthorizationUrl(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $callback, $sessionStore);
    }
    else 
    {
// pass the credentials to initiate a session
$session = YahooSession::requireSession(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID);
// if the in_popup flag is detected,
  // the pop-up has loaded the callback_url and we can close this window.
  if(array_key_exists("in_popup", $_GET)) {
    close_popup();
    exit;
  }
  // if a session is initialized, fetch the user's profile information
  if($session) {
    // Get the currently sessioned user.
    $user = $session->getSessionedUser();
    // Load the profile for the current user.
    $profile = $user->getProfile();
  
  }

by
1 Reply
  • Try this 

      $returnUrl = "http://". $_SERVER['HTTP_HOST'] ."/plan/detail";
                //$returnUrlNew = "http://". $_SERVER['HTTP_HOST'] ."/plan/detail";

                $isActive = YahooSession::hasSession(YAHOO_CUNSUMER_KEY, YAHOO_SECRET_KEY, YAHOO_APPID);

                $authorization_url = YahooSession::createAuthorizationUrl(YAHOO_CUNSUMER_KEY, YAHOO_SECRET_KEY, $returnUrl);
                $this->set('authorization_url', $authorization_url);

                $authorization_url_new = YahooSession::createAuthorizationUrl(YAHOO_CUNSUMER_KEY, YAHOO_SECRET_KEY, $returnUrl);
                $this->set('authorization_url_new', $authorization_url_new);

                if($isActive){
                    //$session = YahooSession::requireSession(CONSUMER_KEY, CONSUMER_SECRET, APPID);
                    $session = YahooSession::requireSession(YAHOO_CUNSUMER_KEY, YAHOO_SECRET_KEY, YAHOO_APPID);
                    $user = $session->getSessionedUser();
                    $contacts = new stdClass();
                    $contacts = $user->getProfile();
                }
    0

Recent Posts

in General Discussion at YDN