使用方法 auth Yodlee API

Consuming method auth Yodlee API

我刚开始使用这个 Yodlee 工具,我创建了我的开发者帐户,我想使用沙盒 API。 我无法使用 Talend Api 休息,甚至无法使用“auth”(https://sandbox.api.yodlee.com/ysl/auth/token) 的初始方法来获取令牌;我按照指定在 header 中传递 loginName、Api-version: 1.1 和 content-type,然后在 body 中传递 clientId 和密码。 returns 的错误信息是:

{
"errorCode": "Y303",
"errorMessage": "clientId or secret is missing",
"referenceCode": "rrt-8413800343306027303-c-gce-12663 ....."
}

也许沙盒帐户不允许我这样做,或者我忘记了什么?

我刚遇到同样的问题。我正在使用 RestSharp。

终于发现不匹配 Content-Type.

添加 header 后有效:Content-Type: application/x-www-form-urlencoded

对于 Google Apps 脚本遇到此问题的任何人,我是这样做的:

/************************************************************************************
 * 
 * This function starts the app, replace variables as necessary
 * 
 ************************************************************************************/

function primaryFunction() {

  // Declare variables
  var yodleeToken = {};
  var loginName = "ENTER_LOGIN_NAME";
  var clientID = "ENTER_CLIENT-ID";
  var clientSecret = "ENTER_CLIENT_SECRET";
  var yodleeURL = "https://sandbox.api.yodlee.com/ysl/";

  // Generate user token
  yodleeToken = getUserToken(loginName, clientID, clientSecret, yodleeURL);
}

/************************************************************************************
 * 
 * Creating function to get user token
 * 
 * @params loginName {String} Login name provided by Yodlee API
 * @params clientID {String} Client ID provided by Yodlee API
 * @params clientSecret {String} Client Secret provided by Yodlee API
 * @params yodleeURL {String} Yodlee API Endpoint
 *
 * References
 * https://av.developer.yodlee.com/
 *
 ************************************************************************************/

function getUserToken(loginName, clientID, clientSecret, yodleeURL) {

  // Specify headers
  var headers = {
    'Api-Version': '1.1',
    'Content-Type': 'application/x-www-form-urlencoded',
    'loginName': encodeURIComponent(loginName)
  };

  // Build params
  var parameters = {
    'method': 'POST',
    'headers': headers,
    'payload': encodeURI("clientId=" + clientID + "&secret=" + clientSecret),
    'redirect': 'follow',
    'timeout': 0,
    // 'muteHttpExceptions': true,
  };

  // Call API with params
  var response = UrlFetchApp.fetch(yodleeURL + "auth/token", parameters);
  var responseJSON = JSON.parse(response);

  // return JSON response with Link Token
  return responseJSON;
}

您需要在 data-urlencode 中传递 clientId 和密钥,在 header 中传递剩余的密钥,然后它会 return token

curl --location --request POST 'https://sandbox.api.yodlee.com/ysl/auth/token' \
--header 'Api-Version: 1.1' \
--header 'loginName: From your dashboard (Sandbox only)' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'clientId=Your clientId' \
--data-urlencode 'secret=Your secret'