0

I'm using WSO2 6.5.0, i created proxy service which calls external REST API,

But I have to add Bearer Token to the Header,

Please refer the below question :

How to call rest service from wso2 proxy service using BEARER Token?
Community
  • 1
  • 1
iderkhangai
  • 311
  • 1
  • 13

1 Answers1

0

Since ESB is working stateless, you have to set Bearer token from the client-side and send the request to the ESB.

Pramodya Mendis
  • 686
  • 8
  • 24
  • How to do that, Can u provide some example But i have to call external rest api which requires Authorization Bearer on HTTP header from WSO2 esb – iderkhangai Oct 23 '19 at 08:18
  • Set this Bearer token in the request which you are calling the ESB proxy. `curl -X POST -d @request.xml http://localhost:8280/services/yourProxy -H "Content-Type: text/xml" -H "Authorization: Bearer XXXXXXXXXXXXXXX"` – Pramodya Mendis Oct 23 '19 at 08:57
  • u do not get me? I need to call below service like that, Through my Proxy service, developed on WSO2, curl -X POST -d @request.json http://ip:port/employee/1 -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXXXXXXXXX" – iderkhangai Oct 23 '19 at 09:04
  • 2
    Then you can send the token in your request and set Authorization header inside the proxy using a **Header mediator**, before calling the service. – Pramodya Mendis Oct 23 '19 at 10:12
  • Like that?? – iderkhangai Oct 24 '19 at 01:47
  • i think it is working, Thank you By the chance, Do u know any sample rest api online which requires the authorization – iderkhangai Oct 24 '19 at 06:03
  • you can check with Salesforce REST API. Dev account is free. Can we resolve this? – Pramodya Mendis Oct 27 '19 at 13:18