У меня есть сценарий, в котором я пытаюсь получить ответы API на следующий URL-адрес хоста моих учетных записей и организаций в облачном хранилище SAP.
https://api.cf.eu10.hana.ondemand.com
Я использую nodejs (обертка cf-client)) сценарий для проверки подлинности, но всякий раз, когда я пытаюсь войти в систему, он отображает ниже ошибку
Error: {"error":"unauthorized","error_description":"{"error":"invalid_grant","error_description":"User authentication failed: INVALID_AUTHORIZATION_HEADER_LENGTH"}"}
Вот мой сценарий nodejs
"use-strict";
const endpoint = "https://api.cf.eu10.hana.ondemand.com";
const username = "myusername"; //I have created a trial account
const password = "Password"; //I have created a trial account
const JsonFind = require('json-find');
const fs = require('fs')
const util = require('util');
const dJSON = require('dirty-json');
const CloudController = new (require("cf-client")).CloudController(endpoint);
const UsersUAA = new (require("cf-client")).UsersUAA;
const Apps = new (require("cf-client")).Apps(endpoint);
const Spaces = new (require("cf-client")).Spaces(endpoint);
const Orgs = new (require("cf-client")).Organizations(endpoint);
CloudController.getInfo().then( (result) => {
UsersUAA.setEndPoint(result.authorization_endpoint);
return UsersUAA.login(username, password);
}).then( (result) => {
Orgs.setToken(result);
return Orgs.getOrganizations();
}).then((result) => {
all_orgs = result.resources //returns api
get_orgs=util.inspect(all_orgs, {depth: null});
console.log(get_orgs)
});
То, что я видел, это когда я обычно входил в систему с клиентом cfтребуется пароль sso и пароль пользователя. как я могу предоставить это здесь или любую идею, как я могу войти здесь и получить данные.