0

ERROR - Failed to create request token: timestamp_refused ERROR - Failed to create request token

I posted this originaly in the sdk forum. I'm going to repost it here in hopes of getting a response smile.gif.

Hey, I'm hoping someone can help me out here. I have created 2 Y applications, both applications are presenting the same error message in the debug console.

Essentially, I'm simply trying to load the session and can't seem to get past this error.

I have changed the keys, no difference. I've verified the keys. The test examples present the identical problem.

This is my code..

CODE
<?
/* #############################################################################

yahoo app platform / wrapper / context / api
by: Paul Lefebvre

############################################################################# */

$ip=$_SERVER['REMOTE_ADDR'];
/* if ($ip != "209.183.9.159") { ?> id - is temporarily down for site maintenance. <meta http-equiv="refresh" content="20;url=http://www.shopnorthern.com"> <? die;} */

if (isset($_GET["flashsignrequest"]) && $_GET["flashsignrequest"] == "on") {
// if (isset($_SESSION["signedin"]) && $_SESSION["signedin"] == "Yes") {
$returnVars = array();
$returnVars['signed'] = "1";
$returnVars['screen'] = "3";
$returnString = http_build_query($returnVars);
echo $returnString;
die;
}

// standard xss protection - initial
foreach ($HTTP_GET_VARS as $secvalue) {
if ((eregi("<[^>]*script*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*iframe*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*object*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*applet*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*style*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*form*\"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*img*\"?[^>]*>", $secvalue)) ||
(eregi("\"", $secvalue)) ||
(eregi("'", $secvalue)) ||
(eregi("<[^>]*cookie*\"?[^>]*>", $secvalue))) {
die ("The server has terminated your scripting request");
}
} //end standard xss protection
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//define file structure - locations
define('ROOT',$_SERVER['DOCUMENT_ROOT'] . '/'); //document root folder
define('MEMBERS',ROOT.'members/'); //members logged in
define('SOURCE',ROOT.'canvas/'); //canvas (this) folder
define('INC',ROOT .'php_inc/'); //php secure includes - must be private at launch

require_once(INC.'errors.php'); //error reporting, etc
require_once(INC.'Yahoo.inc'); //yahoo api, etc

define('OAUTH_CONSUMER_KEY', 'dj0yJmk9eUxoY1dvbEFSTkdvJmQ9WVdrOU5Vc3lUVEE1TkdzbWNHbzlPRFk1TVRjM09UQTImcz1j
b25zdW1lcnNlY3JldCZ4PWU2');
define('OAUTH_CONSUMER_SECRET', '602819be951f0299d26293a551c82b0dd7f2bbd0');
define('OAUTH_DOMAIN', 'http://yahoo.kornerstoneintldev.garohosting.com/canvas');
define('OAUTH_APP_ID', '5K2M094k');

YahooLogger::setDebug(true);
YahooLogger::setDebugDestination('CONSOLE');

session_start();

echo $_SERVER["HTTP_HOST"];

if(array_key_exists("logout", $_GET)) {
// if a session exists and the logout flag is detected
// clear the session tokens and reload the page.
YahooSession::clearSession();
header("Location: sampleapp.php");
}

// 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(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID);

if($hasSession == FALSE) {
// create the callback url,
$callback = YahooUtil::current_url()."?in_popup";

// 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);
}
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();
}
}

echo "testing";

?>


this is the error response.


CODE
ERROR - Signature from YAP failed. DEBUG - HTTP request details DEBUG OBJECT - Array ( [method] => POST [url] => https://api.login.yahoo.com/oauth/v2/get_request_token [code] => 401 [requestHeaders] => Array ( [0] => Accept: application/json [1] => Content-Type: application/x-www-form-urlencoded ) [requestBody] => oauth_callback=http%3A%2F%2Fyahoo.kornerstoneintldev.garohosting.com%2Fcanvas%2F%3Fin_popup&oauth_consumer_key=dj0yJmk9eUxoY1dvbEFSTkdvJmQ9WVdrOU5Vc3lUVEE1TkdzbWNHbzlPR
Fk1TVRjM09UQTImcz1jb25zdW1lcnNlY3JldCZ4PWU2&oauth_nonce=401113646931af05646fe763c6996b3c&oauth_signature=jRfkDgJcEuJoOmSYjht4K0k0DrI%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1257508215&oauth_version=1.0 [responseHeaders] => Array ( [Date] => Fri, 06 Nov 2009 17:28:33 GMT [P3P] => policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV" [WWW-Authenticate] => OAuth oauth_problem=timestamp_refused&oauth_acceptable_timestamps=1257527913-1257529113 [Connection] => close [Transfer-Encoding] => chunked [Content-Type] => application/x-www-form-urlencoded ) [responseBody] => oauth_problem=timestamp_refused&oauth_acceptable_timestamps=1257527913-1257529113 ) ERROR - Failed to create request token: timestamp_refused ERROR - Failed to create request token testing


any help would be great.

by
2 Replies
  • Hi Paul,

    I wanted to let you know that this is on my list to take a look over and try to debug - just so that you don't think that no one is looking at it. As soon as I have an answer I'll post back.

    Jonathan LeBlanc
    Technology Evangelist
    Yahoo! Developer Network
    Twitter: jcleblanc
    0
  • QUOTE (Jonathan LeBlanc @ Nov 16 2009, 02:25 PM) <{POST_SNAPBACK}>
    Hi Paul,

    I wanted to let you know that this is on my list to take a look over and try to debug - just so that you don't think that no one is looking at it. As soon as I have an answer I'll post back.

    Jonathan LeBlanc
    Technology Evangelist
    Yahoo! Developer Network
    Twitter: jcleblanc



    Just an update. Finally got back to this and fixed the problem.

    For some VERY STRANGE reason, copying the keys from firefox does not work , copying from IE does. Very odd.

    Moving forward was able to fix the time stamp issues - note my post in the general forum.
    0

Recent Posts

in PHP Development