Endpoint key authentication setup in API Gateway

Hi All,

This is my first topic discussion which I wanted to discuss on API gateway.

I have a rest endpoint URL with a key based authentication in header. example //https://xxx.co/rest/flights?key=xxxxxxxxxxxx which is fetching me all details available on flights.

When I access with API end point: I get the below error:
API Gateway encountered an error. Error Message: Native service provider error. Code : 401. Request Details: Service - Vegetables, Operation - /rest/flights, Invocation Time:4:29:17 PM, Date:Aug 3, 2020, Client IP - 1.23.52.28, User - Default and Application:null

I am stuck on how to configure this key in API gateway? It is a single time key and is static.

Please guide.

Regards,
Ragav

Hi Ragav,

Looking at the Native Service 401 error, it might be a case that API Gateway doesn’t pass the query parameter to Native Service.

Please check if you have configured your Routing Endpoint URI to end with ${sys:resource_path}. ${sys:resource_path} ensures path parameters and query parameters are passed on to native server.

Alternatively, you can configure the extended setting “forwardQueryParams” to true. Description of this extended setting is given below.

"Specifies whether API Gateway should forward the query parameter sent by client to the native service if the ${sys_resource_path} variable is not present in the Routing policy URL. The default value is ‘false’.

Possible values:
true - API Gateway forwards the query parameters sent by client to the native service even if the S(sys_resource_path) is not present in the Routing policy URL.
false - API Gateway does not forward the query parameters to the native service if the $(sys_resource_path) is not availabile in the Routing policy."

Please try this and check if this works.

Regards,
Vallab

2 Likes