Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppSync: How set header in response?

I want to authorize the user through http only cookies.

I want to set header in the AppSync response as example "Set-Cookie": "cookie=cookie; HttpOnly"

in "Configure the response mapping template" I have $util.toJson($context.result)

How can I do that?

like image 969
Константин Костылев Avatar asked May 30 '18 08:05

Константин Костылев


People also ask

How do you set a response header?

Select the web site where you want to add the custom HTTP response header. In the web site pane, double-click HTTP Response Headers in the IIS section. In the actions pane, select Add. In the Name box, type the custom HTTP header name.

What is CTX in AppSync?

$ctx and $context in AWS AppSync refer to the same Resolver Context. We added $ctx as an alias for $context to reduce the number of characters users have to type ( $ctx is 50% shorter than $context !!) Choosing $context or $ctx is a personal preference.

What is resolver in AppSync?

PDF. Data sources and resolvers are how AWS AppSync translates GraphQL requests and fetches information from your AWS resources. AWS AppSync has support for automatic provisioning and connections with certain data source types.

Is AppSync and API?

AWS AppSync is a serverless GraphQL and Pub/Sub API service that simplifies building modern web and mobile applications. AWS AppSync GraphQL APIs simplify application development by providing a single endpoint to securely query or update data from multiple databases, microservices, and APIs.


1 Answers

This is now possible through $util.http.addResponseHeader: https://docs.aws.amazon.com/appsync/latest/devguide/resolver-util-reference.html#http-helpers-in-utils-http

like image 58
The_Outsider Avatar answered Oct 01 '22 18:10

The_Outsider