Add authorization header to customer API

Hello,

I’m working with POC right now for our customer and I’m trying to configure API connection from Tyk to our customers API. They are using bearer token for authorization and I can’t figure out how can I provide header token in Tok Dashboard. I can only provide authorization token for clients to Tyk but can’t find anything FROM Tyk TO customer API.

So Client ----> Tyk is working fine but
TYK -----> Customer doesn’t beacause customer API requires bearer token for authentication. How can I configure API in Tyk so Tyk uses authorization header to connect to customer API.

This is my first time with Tyk and we are at the same time testing Kong but seems that Tyk is much more powerfull so it would be nice to test it out :slight_smile:

Thanks for all answers!

In the endpoint designer, you can add a static global header to all requests to the upstream.

You should also be able to take info from the session metadata which will enable the authorization header to upstream to be different dependent on the client https://tyk.io/docs/concepts/session-meta-data/ for example: $tyk_meta.METADATA_KEY

You could also grab information from the request context: https://tyk.io/docs/concepts/context-variables/

hope this helps

Thanks! But it doesn’t seems to work. I have added like you said in global version setting but nothing changed.

I have tried to test if via postman but it seems that request is being empty when i see logs.

I’ve got it working! Thanks!

What does this mean?

Strip the listen path

Because I have setup like this:

Listen path:
/app/object/

Target URL:
https://customer.domain.com/

When I have it like this, it does not work but if I uncheck “strip the listening path”, then it’s working. Why?

Ok. I understand now how it’s working in Tyk. All up and running now. Thanks!

That’s great news.

For anybody else who visits this page: it looks like you have enabled PATH based routing:

client sends request to the gateway http://gateway.com/myapi/mypath
The gateway identifies which API is being targeted myapi
The gateway reverse proxies to the upstream, stripping myapi and sending request http://upstream.com/mypath