我試圖(無法)認證自己到其他服務。Angular JS - 連接到Woocommerce OAuth v1
我tryng this library創建所有PARAMS listed here,我創造了這樣的要求:
$scope.oauth = new OAuth({
consumer: {
public: 'ck_d34c32d9c7f6fc1ddb6e85879fc4de89',
secret: 'cs_1867e5e54ce054dde7cf463ad78ee6f9'
},
signature_method: 'HMAC-SHA1'
});
var request_data = {
url: 'http://belfiore.link-me.it/wc-api/v1/orders',
method: 'GET',
}
$scope.data = $scope.oauth.authorize(request_data);
$scope.url = rawurlencode(request_data.url) + "&" +
"oauth_consumer_key"+"%3D"+rawurlencode($scope.data.oauth_consumer_key)+
"%26"+"oauth_nonce"+"%3D"+rawurlencode($scope.data.oauth_nonce)+
"%26"+"oauth_signature_method"+"%3D"+rawurlencode($scope.data.oauth_signature_method)+
"%26"+"oauth_timestamp"+"%3D"+rawurlencode($scope.data.oauth_timestamp)+
"%26"+"oauth_signature"+"%3D"+rawurlencode($scope.data.oauth_signature);
var call = $http.get($scope.url);
call.success(function(res) {
console.log(res);
});
call.error(function(res) {
console.log(res);
});
,但我不斷收到這樣的回答:
"Cannot GET /http%3A%2F%2Fbelfiore.link-me.it%2Fwc-api%2Fv1%2Forders&oauth_consumer_key%3Dck_d34c32d9c7f6fc1ddb6e85879fc4de89%26oauth_nonce%3DwkeLtFTh6WAuxDQGqnpzxAWYOQiHnHSr%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D10%26oauth_signature%3DjFhPbKHnvMEvYf20w1vN3TAV5Ds%3D"
任何幫助?我用Google搜索出來找一些教程或角就緒的文庫FOT您好!OAuth1但我沒有發現任何...提前
感謝
你不應該嘗試手動編碼你的網址。然後,爲了更好地開始,您應該看看http://docs.angularjs.org/api/ng/service/$http - 請注意,您可以將URL參數作爲地圖傳遞。祝你好運! – blint
你有解決方案嗎? –