Hello there!
As the topic suggests, is there a way to access JWT from the auth header in lambda webhooks, or can I use the new @default
directive and put the value from the JWT (e.g., uid
) into the mentioned directive? Thank you!
Hello there!
As the topic suggests, is there a way to access JWT from the auth header in lambda webhooks, or can I use the new @default
directive and put the value from the JWT (e.g., uid
) into the mentioned directive? Thank you!
Hi!
Yes you should be able to access the JWT, see authHeader in webhooks.
This authHeader is sent as part of the request body.
{
Source: ...,
Namespace: ..,
Resolver: ...
AccessJWT: ...,
AuthHeader: {
Key: string, <-- Header specified Dgraph.Authorization
Value: string <-- JWT
},
Event: ...,
}
Let me know if that works.
The @default directive probably does not support your use case. It’s very new and the only variable I know about is $now, which sets datetime to the current datetime.
This is one of those things that is not clear anywhere, and you have to navigate the Discuss to find it in different places.
Basically:
async function addTestWebhook({ graphql, authHeader }) {
...
await graphql(
QUERY_STRING,
VARIABLES_OBJECT,
{ key: authHeader.key, value: authHeader.value }
);
}
@amaster507 - something for the docs…
J