0

Problem with refresh_access_token

I am trying to make the yahoo.application.OAuthApplication.refresh_access_token using the python sdk. Below is the stack trace when i make the call. Basically yahoo API complains that oauth_parameters are missing. Can anyone help me debug this issue.

Thanks
Vivek Puri


CODEBOX
12-27 05:53PM 05.498
fetch_access_token oauth_request.to_header('yahooapis.com'): {'Authorization': 'OAuth realm="yahooapis.com", oauth_nonce="24743187", oauth_session_handle="session handle here", oauth_consumer_key="consumer key here", oauth_timestamp="1261965185", oauth_signature_method="PLAINTEXT", oauth_version="1.0", oauth_token="valid token here", oauth_signature="valid sig here"'}
I 12-27 05:53PM 05.800
fetch_access_token request HTTP status code: 401
I 12-27 05:53PM 05.953
fetch_access_token request HTTP response content: oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key,oauth_token,oauth_signature_metho
d,oauth_signature,oauth_timestamp,oauth_nonce
E 12-27 05:53PM 05.953
from_string() takes exactly 1 argument (0 given)
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 507, in __call__
handler.get(*groups)
File "/base/data/home/apps/linksalpha/116.338756193947541816/api/pubyahoo.py", line 25, in get
oauthapp.token = oauthapp.refresh_access_token(oauthapp.token)
File "/base/data/home/apps/linksalpha/116.338756193947541816/yahoo/application.py", line 88, in refresh_access_token
self.token = self.client.fetch_access_token(request)
File "/base/data/home/apps/linksalpha/116.338756193947541816/yahoo/oauth.py", line 172, in fetch_access_token
return AccessToken.from_string()
TypeError: from_string() takes exactly 1 argument (0 given)

by
2 Replies
  • QUOTE (Vivek Puri @ Dec 27 2009, 06:02 PM) <{POST_SNAPBACK}>
    I am trying to make the yahoo.application.OAuthApplication.refresh_access_token using the python sdk. Below is the stack trace when i make the call. Basically yahoo API complains that oauth_parameters are missing. Can anyone help me debug this issue.

    Thanks
    Vivek Puri


    CODE
    12-27 05:53PM 05.498
    fetch_access_token oauth_request.to_header('yahooapis.com'): {'Authorization': 'OAuth realm="yahooapis.com", oauth_nonce="24743187", oauth_session_handle="session handle here", oauth_consumer_key="consumer key here", oauth_timestamp="1261965185", oauth_signature_method="PLAINTEXT", oauth_version="1.0", oauth_token="valid token here", oauth_signature="valid sig here"'}
    I 12-27 05:53PM 05.800
    fetch_access_token request HTTP status code: 401
    I 12-27 05:53PM 05.953
    fetch_access_token request HTTP response content: oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key,oauth_token,oauth_signature_metho
    d,oauth_signature,oauth_timestamp,oauth_nonce
    E 12-27 05:53PM 05.953
    from_string() takes exactly 1 argument (0 given)
    Traceback (most recent call last):
    File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 507, in __call__
    handler.get(*groups)
    File "/base/data/home/apps/linksalpha/116.338756193947541816/api/pubyahoo.py", line 25, in get
    oauthapp.token = oauthapp.refresh_access_token(oauthapp.token)
    File "/base/data/home/apps/linksalpha/116.338756193947541816/yahoo/application.py", line 88, in refresh_access_token
    self.token = self.client.fetch_access_token(request)
    File "/base/data/home/apps/linksalpha/116.338756193947541816/yahoo/oauth.py", line 172, in fetch_access_token
    return AccessToken.from_string()
    TypeError: from_string() takes exactly 1 argument (0 given)



    Hi Vivek,

    It looks like there was an oauth error that was not handled properly. I checked the tests and they work as expected for the python sdk, can you provide the complete http request/response?
    0
  • QUOTE (Dustin Whittle @ Jan 4 2010, 04:58 PM) <{POST_SNAPBACK}>
    Hi Vivek,

    It looks like there was an oauth error that was not handled properly. I checked the tests and they work as expected for the python sdk, can you provide the complete http request/response?


    If you enable debugging in the python sdk, you can check the application log for the complete http request/response. Otherwise, you can run the appengine dev server and print the request response. I am most interested in the oauth_error that is return in the http headers. The following should work given valid ck/cks/app id/callback:

    app = yahoo.application.OAuthApplication(CONSUMER_KEY, CONSUMER_SECRET, APPLICATION_ID, CALLBACK_URL, ACCESS_TOKEN)
    app.token = self.oauthapp.refresh_access_token(self.oauthapp.token)
    profile = app.getProfile()

    print profile

    I took the sample from the test here: http://github.com/yahoo/yos-social-python/..._application.py
    0

Recent Posts

in OAuth General Discussion YDN SDKs