Learn Android for Free,issues for developers, mobengineers website provide complete solutions for developers issues posts.It also provides online training for android development

Wednesday, August 31, 2016

Api gateway - Api key- 403- "message": "Forbidden"

Aws api gateway with api giving the following error
 {"message": "Forbidden"} 
I am working with aws api gateway with nodejs as server. I defined my api using swagger yaml and  deployed to aws api gateway.

Next step is to implement authentication to the api.

Api gateway itself providing authentication mechanism.
Using api key to authenticate the request.

if API keys are enabled, you can set the x-api-key:{api_key} name/value pair here

If the api key is enabled for the api method, then you can set x-api-key: {api_key}  name/value pair in the header.

I used swgger ui and set the api key, but didnt work.
I resolved after few hours struggling.
Change frpm window.swaggerUi.api.clientAuthorizations.add( "bearer", apiKeyAuth ); with window.swaggerUi.api.clientAuthorizations.add( "jsonWebToken", apiKeyAuth );

The name you will assign to the ApiKeyAuthorization from client need to match the name you give the security scheme under swagger definitions.

0 coment�rios:

Post a Comment

20% off

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

NDTV Gadgets360

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts