Hi, 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.
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('https://upload.twitter.com/1.1/media/upload.json', {
params: {
media:'imageurl'
//media_data: 'base65'
}
}).success(function(response) {
$scope.response = response;
}).error(function(error) {
$scope.error = error;
});