Sorry guys -- it was due to my server time being off!!  Fixing this fixed my
problem.  Sorry for the spam!
PT

On Wed, Nov 3, 2010 at 2:06 PM, Paul Tongyoo <paul.tong...@gmail.com> wrote:

>
> Hi all--
>
> I've recently begun encountering an odd issue -- Status Updates via
> OAuth-signpost have begun to fail from my production server, however they
> continue to submit successfully from my local machine.  To me, this
> indicates an environmental issue rather than a code issue ... but what could
> be the culprit?  I am using essentially the same code from the signpost
> examples to post an status update -- would you anyone have an idea as to
> what might be the issue?  I have confirmed the consumer keys and user tokens
> match between local and production servers.
>
> Thanks in advance for any tips!
> Paul
>
>
>
>     HttpPost post = new HttpPost("http://twitter.com/statuses/update.xml
> ");
>
>     final List<NameValuePair> nvps = new ArrayList<NameValuePair>();
>
>     // 'status' here is the update value you collect from UI
>     nvps.add(new BasicNameValuePair("status", tweetText));
>     post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
>
>     // set this to avoid 417 error (Expectation Failed)
>
> post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE,
> false);
>
>     // sign the request
>     CommonsHttpOAuthConsumer consumer = new
> CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
>     consumer.setTokenWithSecret(token, secret);
>     consumer.sign(post);
>
>     // send the request
>     final HttpResponse response = httpClient.execute(post);
>
>     // response status should be 200 OK
>     int statusCode = response.getStatusLine().getStatusCode();
>     final String reason = response.getStatusLine().getReasonPhrase();
>
>     // release connection
>     response.getEntity().consumeContent();
>
>     if (statusCode != 200) {
>       throw new OAuthNotAuthorizedException(reason);
>     }
>
> Received exception:
>
> oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed
> (server replied with a 401). This can happen if the consumer key was not
> correct or the signatures did not match.
>
>

-- 
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

Reply via email to