I am building out an app and need to return a field with true or false logic with a Lambda Field resolver. I need to return true if the JWT provided is the user.
type User {
email: String! @id
isSelf: Boolean @lambda
}
This does not work though because authHeader is passed to the server but not through the addGraphQLResolver as a property.
This otherwise would be a simple feat to get this boolean field, but now, I have to do it all on client side, which means changing a front end that I am trying not to change. I am trying to just replace a custom GraphQL endpoint with Slash and hoping for an easier transition.
Other use cases: use the JWT to resolve a lambda field if the user is someone I am following or follows me. Use the JWT to see if I am the author of a post in a lambda field resolver.
Any update here? I need to access the JWT in my lambda. This is useful for a few reasons… to secure the lambda, perform custom logic using JWT claims and even to perform extended API calls to custom servers that accept the token.
This was fixed yesterday, please update your lambda script ot see the changes. You now will recieve authHeader = {key: “My-Header-Name”, value: “jwt-here”} to the lambda resolver. All calls to graphql automatically pass this header back.