0

[timestamp_refused] ASP Classic

Hello, 
I look everywhere on the web and i haven't found a solution.

I have this error when i trie to call this "http://social.yahooapis.com/v1/user/gUID/contacts"

{
"error":{
    "lang":"en-US",
    "description":"Please provide valid credentials. OAuth oauth_problem=\"timestamp_refused\",
    realm=\"yahooapis.c
om\""
}
}

My process is this : 

<%
if (request.querystring("oauth_token") = "") then 
    resultat = getHTML("https://api.login.yahoo.com/oauth/v2/get_request_token?" _
&"oauth_nonce="&rnd _ 
&"&oauth_timestamp="×tamp _ 
&"&oauth_consumer_key="&yahoo_consumer_key _ 
&"&oauth_signature_method=plaintext" _
&"&oauth_signature="&yahoo_consumer_secret&"%26" _   
&"&oauth_version=1.0"
&"&xoauth_lang_pref=fr-fr" _   
&"&oauth_callback=http://xxx.xxx.xxx/yahoo.asp")
    session("timestamp") = timestamp     
    ' I Retrieve the xoauth_request_auth_url and oauth_token_secret,
    ' and i redirect my member to xoauth_request_auth_url
session("oauth_token_secret") = oauth_token_secret
    response.redirect(URLDecode(xoauth_request_auth_url))

' The User Accept and he is redirected on my callback page (this is the same page for all treatment)    
else 
timestamp = session("yahoo_timestamp")
    oauth_token = request.querystring("oauth_token")
    oauth_verifier = request.querystring("oauth_verifier")
oauth_token_secret = session("oauth_token_secret")

' i call the get token url : 

get_token_url = "https://api.login.yahoo.com/oauth/v2/get_token?oauth_consumer_key="&yahoo_consumer_key _  
&"&oauth_signature_method=PLAINTEXT" _
&"&oauth_version=1.0"
&"&oauth_verifier="&oauth_verifier _   
&"&oauth_token="&oauth_token _
&"&oauth_timestamp="×tamp _   
&"&oauth_signature="&yahoo_consumer_secret&"%26"&oauth_token_secret _    
&"&oauth_nonce="&rnd 
res_get_token = getHTML(get_token_url)

    ' and i call the api for retrieve contact : 
    get_contacts_url = "http://social.yahooapis.com/v1/user/"&xoauth_yahoo_guid&"/contacts?"
&"&format=json"
&"&oauth_consumer_key="&yahoo_consumer_key _   
&"&oauth_signature_method=HMAC-SHA1" _   
&"&oauth_timestamp="×tamp _  
&"&oauth_token="&oauth_token _   
&"&oauth_version=1.0" _
&"&oauth_signature="&oauth_signature _ 
&"&oauth_nonce="&rnd _ 
&"&realm=yahooapis.com"
response.write getHTML(get_contacts_url)
    ' The result is the error above  

end if
%>    



Appendix :
 
<%
function getHTML (strUrl)
    Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP")
    xmlHttp.Open "GET", strUrl, False
    xmlHttp.setRequestHeader "User-Agent", "asp httprequest"
    xmlHttp.setRequestHeader "content-type", "application/x-www-form-urlencoded"
    xmlHttp.Send
    getHTML = xmlHttp.responseText
    xmlHttp.abort()
    set xmlHttp = Nothing   
end function  %>


Thanks for your help ... 

by
1 Reply
  • Convert your timestamp to NTP time stamp or from GMT then try it should work
    1

Recent Posts

in Contacts