However, this means that we need to create a service key in addition to the service instance.īelow is the description for creating both. Http client nodejs code#We want to run our code locally, to make things easier. We need to create an instance of the XSUAA service, which will act as server and which will provide us with the required credentials. Preparationįor those who wish to follow the example, here’s the description: However, the code should work with any other server as well, so you can just copy the snippets and don’t need extra cloud access. This tutorial is based on trial account in SAP BTP. In order to follow the description, you need access to SAP BTP, and permission/quota for creating the service instance. You can find basic information about certificates in this blog post. This blog post assumes that you’re Node.js user and a bit familiar with certificates. If not, please add your sample code in the comment section. I hope to somewhat meet your expectations…. I’m posting 4 samples that are based on different libraries, including the native way. However, if desired, it is easy to modify the code such that it runs in the cloud. We don’t need to deploy an app, as such we can keep the code minimalistic. Our client code is just a script which we can run from our local laptop. I’ve chosen this scenario because it is real use case and it is easy to reproduce for anybody. The HTTP request is successful (and we’re satisfied) if the request returns a valid response (containing a token). The credentials which we need (certificate) are given to us by the service instance. The HTTP request we’re sending is used to fetch a token. The server which receives our HTTP request is the XSUAA service. We’re executing an HTTP request from client to server. Http client nodejs how to#This blog post contains sample code (node.js) showing how to execute an HTTP request that authenticates with client certificate instead of user/password.Īs example setup, we’re using the SAP Business Technology Platform (SAP BTP, fka SAP Cloud Platform). Need to fire request with client certificate?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |