Hi guys,
I have read many threads on this topic, including: https://github.com/nraboy/ng-cordova-oauth/issues/45
and http://blog.ionic.io/displaying-the-twitter-feed-within-your-ionic-app/ but I suspect I might be missing something here. I’m using the latest “ng-cordova-oauth”: “~0.1.0” to get an access token before calling the twitter search api.
Problem: “Data: {“errors”:[{“code”:32,“message”:“Could not authenticate you.”}]}” from $http.get(url)… on iOS where var url = ‘https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi’; (Twitter Search API using encoded URL)
Note: This Twitter Status API URL (same as the postl by @saimon24) would work fine though ‘https://api.twitter.com/1.1/statuses/home_timeline.json’. I could get the correct data back.
I also followed Simon’s post by calling this prior to the API call
function createTwitterSignature(method, url, queryObj) {
var token = angular.fromJson(getStoredToken());
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(method, url, oauthObject, queryObj, clientSecret, token.oauth_token_secret);
$http.defaults.headers.common.Authorization = signatureObj.authorization_header;
}
The method above gave me the access token which I’d later use to call the API.
Anyone know why it I got code 32 only on the search API?
Thank you,
ari