I am developing an app. I have done Login Using OAuth. Now i want to post an Image to my Twitter Account.But each time i am getting Capacity Over Error message.I tried with Both media and media_data after converting my String into Base64.I am trying with Ionic and Angular JS.You can also suggest me any Other Solution. My code is below.
var clientId = "**************";
var clientSecret = "*****************";
/** Twitter oauth for User Details **/
// Accessing profile info from twitter
var oauthObject = {
oauth_consumer_key: clientId,
oauth_nonce: $cordovaOauthUtility.createNonce(10),
oauth_signature_method: "HMAC-SHA1",
oauth_token: token.oauth_token,
oauth_timestamp: Math.round((new Date()).getTime() / 1000.0),
oauth_version: "1.0"
};
var signatureObj = $cordovaOauthUtility.createSignature("POST", "https://upload.twitter.com/1.1/media/upload.json" , oauthObject, { }, clientSecret, token.oauth_token_secret);
$http.defaults.headers.common.Authorization = signatureObj.authorization_header;
//$http.post(url, {media_data: 'base64'},{headers: { 'Content-Type': 'multipart/form-data'}}).success(function(
$http.post(url, {media: 'Image URL'},{headers: { 'Content-Type': 'multipart/form-data'}}).success(function(result) {
console.log(result)
})
.error(function(result) {
console.log(result)
});
Anybody can help me in this Problem.