ari suwendi created CB-9144:
-------------------------------
Summary: Error 32 ( Authentication Error ) on Twitter Search API
Key: CB-9144
URL: https://issues.apache.org/jira/browse/CB-9144
Project: Apache Cordova
Issue Type: Bug
Components: CordovaJS
Reporter: ari suwendi
From: https://github.com/nraboy/ng-cordova-oauth/issues/64
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)
I call 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;
}
it seems that this problem is triggered IF the query param contains special
character that changes on URL encoding. On further investigation it's because
the oauth signature generated by cordova ($cordovaOauthUtility.createSignature,
most likely caused by the encoding-decoding algorithms/process) does NOT match
the signature generated by twitter - this mismatch causes this error 32.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]