(Migrated) Outgoing HTTP connection & API Key

(This message has been automatically imported from the retired mailing list)

Hi,

I’m trying to issue a request against an external HTTP/JSON API which
relies upon a custom header to perform authentication (X-API-Key).

Even though I’m able to define such authentication mechanism under Security
-> Api Keys in the web admin, I’m not able to pick it up from the outgoing
channel definition. It shows for instance HTTP basic auth credentials I had
created for another connection, but not the ones based on Api Keys.

Am I doing something wrong? Can this authentication mechanism be used for
outgoing connections?

Thanks!

On 16/03/15 15:33, Andrés Fernández wrote:

Hi there,

Can this authentication mechanism be used for outgoing connections?

you are correct that it cannot be used in 2.0.

If you open a ticket in GH I believe it won’t be difficult to extend the
backend so that API keys are supported in outgoing connections in 2.1.

Right now you can achieve the same through:

conn = self.outgoing.plain_http[‘My Conn’].conn
auth = {‘X-API-Key’: ‘My Key’}
response = conn.post(self.cid, ‘Request’, headers=auth)

And the value of X-API-Key can be kept, for instance, in an INI file:

https://zato.io/docs/progguide/service-local-config.html

Thank you Dariusz,

I will open a ticket on GH.

On Mon, Mar 16, 2015 at 3:52 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 16/03/15 15:33, Andr=C3=A9s Fern=C3=A1ndez wrote:

Hi there,

Can this authentication mechanism be used for outgoing connections?

you are correct that it cannot be used in 2.0.

If you open a ticket in GH I believe it won’t be difficult to extend the
backend so that API keys are supported in outgoing connections in 2.1.

Right now you can achieve the same through:

conn =3D self.outgoing.plain_http[‘My Conn’].conn
auth =3D {‘X-API-Key’: ‘My Key’}
response =3D conn.post(self.cid, ‘Request’, headers=3Dauth)

And the value of X-API-Key can be kept, for instance, in an INI file:

https://zato.io/docs/progguide/service-local-config.html