updateStatus method does not work for Twitter
Closed this issue · 4 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1.load configurations, keys etc and store the Twitter provider to 'ap'
AuthProvider object
2.call ap.updateStatus("Test");
What is the expected output? What do you see instead?
The Twitter status should be updated.
org.brickred.socialauth.exception.SocialAuthException: Failed to update status
on http://api.twitter.com/1/statuses/update.json?status=Test. Staus :401
at org.brickred.socialauth.provider.TwitterImpl.updateStatus(TwitterImpl.java:255)
...
There is also a minor typo in the message
What version of the product are you using? On what operating system?
4.0 - Windows
Please provide any additional information below.
I have tested other custom queries, like one that gets my timeline, with api
function and they work so I use a valid token.
The problem must exist with certain post queries.
A workaround I found is to put parameters of post requests in the body. This is
described in the OAuth tool description under Request query.
This tool is available on the right of every rest API documentation page if you
are logged in
I tested that using apigee console for twitter
(https://apigee.com/console/twitter) in which the request also fails if default
parameters are used.
I selected the Body tab and filled in Parameter 'status' and in value 'test'.
The request succeeded
When I filled 'status=test' in body request returned '401 API is secure. Needs
security Credentials'
However I don't know how to make a successful request in SocialAuth and if api
Provider function supports it.
Original issue reported on code.google.com by kpsyc...@gmail.com
on 25 Feb 2013 at 7:47
GoogleCodeExporter commented
Update of additional information.
A twitter rest api documentation page of status update is the following
https://dev.twitter.com/docs/api/1.1/post/statuses/update
SocialAuth uses 1 version not 1.1 but the problem is the same for both
Original comment by kpsyc...@gmail.com
on 25 Feb 2013 at 7:57
GoogleCodeExporter commented
It is working fine for me. Though we are adding status parameter in query
string but at end before making POST request we add this in body and removed
from query string.
LOG details as given below of my request and it is working fine.
210877 17:08:09,105 INFO org.brickred.socialauth.provider.TwitterImpl -
Updatting status New Testing
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer -
Generating OAUTH Signature
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer - Given
Signature Type : HMAC-SHA1
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer - Given
Method Type : POST
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer - Given
URL : http://api.twitter.com/1/statuses/update.json
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer - Given
Parameters : {status=New Testing, oauth_nonce=1362483489105, oauth_version=1.0,
oauth_signature_method=HMAC-SHA1, oauth_consumer_key=0R33UqVOf6bJDCHwNTUlSg,
oauth_token=XXXXX, oauth_timestamp=1362483489}
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer -
Signature data :
POST&http%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&oauth_consumer_ke
y%3D0R33UqVOf6bJDCHwNTUlSg%26oauth_nonce%3D1362483489105%26oauth_signature_metho
d%3DHMAC-SHA1%26oauth_timestamp%3D1362483489%26oauth_token%3DXXXXX%26oauth_versi
on%3D1.0%26status%3DNew%2520Testing
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer - Encoding
raw HMAC to Base64
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer -
Genrating Authorization header for given parameters :
{oauth_signature=mHsXq4LJL67973KR5SJNl8j1S7E=, status=New Testing,
oauth_nonce=1362483489105, oauth_version=1.0, oauth_signature_method=HMAC-SHA1,
oauth_consumer_key=0R33UqVOf6bJDCHwNTUlSg, oauth_token=XXXXX,
oauth_timestamp=1362483489}
210923 17:08:09,151 DEBUG org.brickred.socialauth.util.OAuthConsumer -
Authorize Header : OAuth
oauth_consumer_key="0R33UqVOf6bJDCHwNTUlSg",oauth_nonce="1362483489105",oauth_ti
mestamp="1362483489",oauth_signature_method="HMAC-SHA1",oauth_version="1.0",oaut
h_token="XXXXX",oauth_signature="mHsXq4LJL67973KR5SJNl8j1S7E%3D"
Can you please check while showing authorization page of twitter, are you able
to se POST Message permission request.
Regards
Tarun
Original comment by tarun.na...@3pillarglobal.com
on 5 Mar 2013 at 11:47
GoogleCodeExporter commented
You are right I was using a read-only access token.
I generated a new one with write access as well from
https://dev.twitter.com/apps.
I am not running a web application so I don't authorize Twitter directly.
Original comment by kpsyc...@gmail.com
on 5 Mar 2013 at 12:38
GoogleCodeExporter commented
Great!
Closing this issue now.
Hey, we have our portal http://labs.3pillarglobal.com . We are planning to
feature applications on our Portal those are using SocialAuth.
It’ll be great if you can provide some information about your application so
that we can feature it on our portal.
Original comment by tarun.na...@3pillarglobal.com
on 6 Mar 2013 at 1:14
- Changed state: Done