Sure, Matt, sorry if it sounds like I want you to speak for them :) Cheers, Choock.
On 8 фев, 03:16, Matt Harris <thematthar...@twitter.com> wrote: > Hi Choock, > > I can't speak for why TwitPic works one way or the other. You would need to > speak to them directly about how they implement OAuth Echo. > > Best > @themattharris > Developer Advocate, Twitterhttp://twitter.com/themattharris > > > > > > > > On Mon, Feb 7, 2011 at 3:54 PM, Choock <d.cho...@gmail.com> wrote: > > Thank you Matt, please see below > > > On 8 фев, 02:00, Matt Harris <thematthar...@twitter.com> wrote: > > > Hi Choock, > > > > Twitpic is a 3rd party service so they would no more about their API. > > That > > > being said the OAuth Echo parameter is X-Auth-Service-Provider so it > > sounds > > > like, by changing the header, you're not using OAuth Echo now. > > > Then how am I authorized? I got 401 all the time before and now I can > > upload files. > > It sounds like Twitpic handles X-Auth-Service-Provider incorrectly > > and X-OAuth-Service-Provider just right. > > > > In addition, TwitPics documentation states the parameter the same as our > > > documentation: > > > http://dev.twitpic.com/docs/2/upload/ > > > Yeah, that's true, this is what I wanted to say, second link to > > twitter docs was added by mistake. > > > > Best > > > @themattharris > > > Developer Advocate, Twitterhttp://twitter.com/themattharris > > > > On Mon, Feb 7, 2011 at 2:48 PM, Choock <d.cho...@gmail.com> wrote: > > > > Have just uploaded to Twitpic all correct! > > > > > Adding one single letter solves the problem. Name for the service > > > > provider header should be: > > > > > "X-OAuth-Service-Provider" > > > > > and not > > > > > "X-Auth-Service-Provider" > > > > > as it stated herehttp://dev.twitter.com/pages/oauth_echoandhere > > > >http://dev.twitter.com/pages/oauth_echo > > > > > --Choock > > > > > On 8 фев, 00:43, Choock <d.cho...@gmail.com> wrote: > > > > > Hello all, > > > > > > can anybody help me with TwitPic please? Just cannot figure out what > > > > > am I doing wrong :( > > > > > > I'm trying to upload a pic making POST request tohttp:// > > > > api.twitpic.com/2/upload.json > > > > > To do this I create required header mocking GET and signing it: > > > > > > HttpGet oauth_get = new HttpGet("https://api.twitter.com/1/account/ > > > > > verify_credentials.json"); > > > > > signer.signRequest(oauth_get); > > > > > > (using Commons httpclient 4.1 and signpost) > > > > > > Then I cut out and modify header as required by TwitPic: > > > > > > String get_value = > > > > > oauth_get.getFirstHeader("Authorization").getValue(); > > > > > get_value = get_value.replaceFirst("OAuth ","OAuth realm= > > > > > \"http://api.twitter.com/\", "); > > > > > > Then I create actual POST request, add required headers and > > paramenets > > > > > (key,message, file): > > > > > > HttpPost method = new HttpPost("http://api.twitpic.com/2/ > > > > > upload.json"); > > > > > method.setHeader("X-Verify-Credentials- > > > > > Authorization",get_value); > > > > > method.setHeader("X-Auth-Service-Provider","https:// > > > > > api.twitter.com/1/account/verify_credentials.json"); > > > > > MultipartEntity entity; > > > > > FileBody media = new FileBody(pic,"image/png"); > > > > > > entity = new > > > > > MultipartEntity(null,null,Charset.forName("UTF-8")); > > > > > entity.addPart("media",media); > > > > > try > > > > > { > > > > > for(NameValuePair pair:params) > > > > > { > > > > > entity.addPart(pair.getName(),new > > > > > StringBody(pair.getValue(),Charset.forName("UTF-8"))); > > > > > } > > > > > method.setEntity(entity); > > > > > } > > > > > catch(UnsupportedEncodingException e) > > > > > { > > > > > logger.log(Level.WARNING, e.toString()); > > > > > } > > > > > return method; > > > > > > And then I send the request (method). Here is what I receive: > > > > > > WARNING: Authentication error: Unable to respond to any of these > > > > > challenges: {} > > > > > and right after 401 error code. > > > > > > It is important that direct call to Twitter for verification: > > > > > > HttpGet method = new HttpGet("https://api.twitter.com/1/account/ > > > > > verify_credentials.json"); > > > > > signer.signRequest(method); > > > > > return method; > > > > > > returns OK what means all authentification parameters correct. So, > > it > > > > > is the header for TwitPic. Can anybody point out what's wrong with > > how > > > > > am I creating it? > > > > > > Thank you. > > > > > -- > > > > 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 -- 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