Friday, April 1, 2011

Re: [twitter-dev] Reg: unauthorirzed error while getting profile url

Hi Yaswath,

While you might have something else wrong additionally, I'll make a couple quick points:

a) the URL (and all REST resource URLs) should have a version: you want https://api.twitter.com/1/account/verify_credentials.xml -- if you don't put the version there, your code will stop working completely one day. Without a version there today, you'll get weird behavior.

b) Your OAuth query parameters includes an oauth_verifier -- you should only send this parameter to the oauth/access_token step and discard it -- by including it in the request here, you may be invalidating it.

If it's possible for you to use HTTP header-based OAuth, I would highly recommend favoring it over this query string approach -- header-based auth is generally easier to debug and easier to get right.

Finally, access tokens can be manually expired by the end-user at any time; they don't intrinsically have an expiration time though.

@episod - Taylor Singletary


On Fri, Apr 1, 2011 at 6:17 AM, yaswanth kumar <yaswanthcse@gmail.com> wrote:
Hi,

Currently i am using oAuth to get the public profile of the twitter

Details are:
_oauth.oAuthWebRequest(oAuthTwitter.Method.GET, "https://
api.twitter.com/account/verify_credentials.xml",string.Empty);

this is the webrequest i am using to get the profile but this is
working in an intermitten way.

Its throwing error like :

<?xml version="1.0" encoding="UTF-8"?>
<hash>
 <request>/account/verify_credentials.xml?
oauth_consumer_key=oX9ZTIjxulA1dTpWPk7HA&amp;oauth_nonce=8868298&amp;oauth_signature_method=HMAC-
SHA1&amp;oauth_timestamp=1301663655&amp;oauth_token=PYg58LLcIlDFCFFHy0AAi9Z30k0dUKDSFrDAiTjnXkQ&amp;oauth_verifier=JzN6a5BIE0XCpCh7ER2YjVWkZIxVK4dAYwqYujRnOA&amp;oauth_version=1.0&amp;oauth_signature=njf2uxyVlBpclvvP4BOzOEF3orU
%3d</request>
 <error>Could not authenticate you.</error>
</hash>

Can anyone help me in resolving this issue.

And is there any expiry of the access token that was obtained?

Thanks,
Yashwanth Konathala.

--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: http://groups.google.com/group/twitter-development-talk

--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: http://groups.google.com/group/twitter-development-talk

No comments:

Post a Comment