I am working on an IONIC project with angular. I want to publish tweet to a specific twitter account from the IONIC app. How can I do that? I tried to use https://github.com/Aoinu/ng2-twitter this NPM package, but no luck. For browser, it is giving below error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.twitter.com/1.1/statuses/update.json. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
When I am trying from Ionic DevApp in iPhone 6, it is not giving any error but tweet is not posting.
Thanks in advance for any help.
I used below code which is calling after submit a from.
getHomeTimeline(){
this.twitter.post(
'https://api.twitter.com/1.1/statuses/update.json',
{
status: 'test Tweet'
},
{
consumerKey: 'consumerKey',
consumerSecret: 'consumerSecret'
},
{
token: 'My twitter token',
tokenSecret: 'Token Secret'
}
).subscribe((res)=>{
//this.result = res.json().map(tweet => tweet.text);
console.log(res);
console.log('working');
});
}