I am trying to figure out if below use case is possible using tyk,
Use Case
Sales Force (API provider) -> Tyk -> Backend System (API consumer)
In order to consume API provided by Sales Force, first we need to get access token using url Endpoint1 and then with the access token call Endpoint2 of sales force.
Trying to achieve
Will expose only one API from Tyk towards Backend system. When Backend sends the request towards Tyk, Tyk will first call endpoint1 (with custom inputs) of Sales force to get access token and then append that access token in the request which came from backend and send the updated request towards Sales force using endpoint2.
Request you to please let me know if it is possible.
Have gone through the link you have shared.
What I understand now is,
Tyk will expose one api, when request comes to the api first endpoint will get invoked which is mention in the target url of core settings, and then the virtual endpoint code. [ Please correct me if my understanding is wrong]
Issue what I see here is , request accepted by sales force for generating access token is in application/x-www-form-urlencoded. Code sample is sharing JSON.
Please help me out in knowing how the content type application/x-www-form-urlencoded can be send in request
Thank you for the guidance, was now able to successfully two calls using JS function from virtual endpoint.
Though I have one doubt, while returning back the response from JS function, how can we send the complete header which is received from the actual endpoint call.
I am using the below code for sending the final response back,