on 09-03-2018 9:00 AM
Hi everybody,
I'm trying to develop an application for a blockchain scenario (digital asset transfer) but unfortunately when I launch the app I get an error (403 forbidden).
If I execute the json-rpc call with Postman, everything works fine but if I use the following code in the controller.js in Web IDE it doesn't work.
I have already set up the destination in SCP and in the neo-app.json.
Could you please help me to solve this issue?
jQuery.ajax({
type: "POST",
url: "/blockchainasset/*******************************/rpc",
beforeSend: function (request) {
request.setRequestHeader("apikey", "************************");
},
data: JSON.stringify({
"method": "getaddresses"
}),
dataType: "json",
contentType: "application/json",
success: function (data, textStatus, jQxhr) {
console.log(data);
},
error: function (jqXhr, textStatus, errorThrown) {
console.log(errorThrown);
}
});
Hi Davide,
there seems to be a solution for this problem:
Please try to whitelist the APIKEY header field by adding the following entry to the neo-app.json:
"headerWhiteList": ["APIKEY"]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Davide.
This most likely seems to be a CORS problem.
You won't be able to call MultiChain RPC Endpoint using only a frontend application because of security concerns.
Greetings,
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think that the main problem is the authentication in your destination.
Are you using the SAP Blockchain service?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, the obvious question is: are you passing the APIKEY inside the request's header? 😄
I don't remember the reason but we needed to add to the layer an external expressjs middleware to handle the REST request to the Blockchain API instead of passing directly through XSJS (we didn't have XSA but only XSC).
Another important thing: we din't use the multichain service.
ExpressJS is just a nodejs framework that allows you to build a nodejs backend. You can deploy it wherever you want. But this was my solution. I would suggest you to contact someone from SAP to choose the best option that fit your needs. You also should be able to use SAP API huh to connect to your Blockchain service.
Ok, thank you for your support!
i would say this is related to the destination, what is the error you are seeing in the network tab? check the url is formed correctly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.