我正在使用paypal API並與此文檔流動make your firest call。Paypal API with angular | 400(錯誤請求)
我得到一個錯誤消息的狀態碼400(錯誤請求):
對象{錯誤: 「INVALID_REQUEST」,ERROR_DESCRIPTION: 「grant_type是必需的參數」}
'Authorization': "Basic RU9KMlMtWjZPb05fbGVfS1MxZDc1d3NaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA6RUNsdXNNRVVrOGU5aWhJN1pkVkxGNWNaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA=",
在這種我使用了示例提供的Client-Id和Secret,並將它們編碼爲64位。
$http({
url: 'https://api.sandbox.paypal.com/v1/oauth2/token',
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': "Basic RU9KMlMtWjZPb05fbGVfS1MxZDc1d3NaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA6RUNsdXNNRVVrOGU5aWhJN1pkVkxGNWNaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA=",
'Accept-Language': 'en_US'
},
data: { grant_type: 'client_credentials' }
}).success(function (data, status, headers, config) {
console.log(data)
}).error(function (data, status, headers, config) {
console.log(data)
});
那麼你的問題是什麼? – mindparse 2015-02-07 19:44:50