0
down vote
favorite
so my app can sign people in to twitter, can send tweets, and suck in followers etc.
However getting stumped with how to upload an image…
so far all my requests are to api.twitter.com
now i build my signature base string with the standard oath parameters
[parameterList addObject:[NSString stringWithFormat:@"%@=%@&",consumerKeyKey,consumerKeyValue]];
[parameterList addObject:[NSString stringWithFormat:@"%@=%@&",nonceKey,nonceValue]];
[parameterList addObject:[NSString stringWithFormat:@"%@=%@&",signatureMethod,signatureMethodValue]];
[parameterList addObject:[NSString stringWithFormat:@"%@=%@&",tokenKey,tokenKeyValue]];
[parameterList addObject:[NSString stringWithFormat:@"%@=%@&",timestampKey,timeStampValue]];
[parameterList addObject:[NSString stringWithFormat:@"%@=%@&",oauthVersionKey,oauthVersionValue]];
Then i construct the base string with the Http method, the url , and then the parameters above, url encode it and hash the lot. Never had any problems
However now i am trying to use upload.twitter.com/1.1/media/upload.json
i am passing a body parameter “media_data” which contains a base64 encoded image
so i tried first using the standard pattern (https method, url , oath parameter list) it failed (401)
then i read this somewhat ambiguous instruction here
https://dev.twitter.com/rest/public/uploading-media
Because the method uses multipart POST, OAuth is handled a little differently. POST or query string parameters are not used when calculating an OAuth signature basestring or signature. Only the oauth_* parameters are used.
so i don’t have query string parameters, so fine, and i can remove the HTTP method
what about the url? this isn’t mentioned anywhere??
suffice to say i tried with no method (so just url, parameters) got a 401
then tried removing the url so just parameters got a 401
does anyone know exactly what values need to go into the base string when calculating the auth header for upload.twitter.com/1.1/media/upload.json" ??