awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
921 stars 266 forks source link

Add custom header #585

Open jacekv opened 4 years ago

jacekv commented 4 years ago

Good morning everyone,

I am working on a project, where I have a lambda function which acts as a proxy between a client and Aws AppSync. First we used API Key as authentication method for AppSync but we want to switch to IAM authentication. I found an example on how to forward graphql queries and mutations using your sdk.

It is possible to pass http header information to AppSync, which can be accessed through the $context.request.headers object. Is there a way of setting customer header information in your sdk?

I tried to find a way but I haven't found anything documented. I also checkd the issues but it seems like most people are having a hard time with this.

Best Jacek

jakubsekowski commented 3 years ago

+1 @jacekv have you found a way to add a custom HTTP header to the AppSync requests?

jacekv commented 3 years ago

Sadly, we haven't found a simple way. At the end we solved it using a gateway which added the required header.

bpcrao commented 3 years ago

I thought I am alone, any other alternatives?