remote schema subscription proxy with auth #429
-
I have a schema that proxies some operations to a remote schema. This includes subscriptions. I am upgrading to Every operation that comes through the main service will pass in an authorization token. Even for subscriptions. This token must be proxied through to the remote schema in order for the subscriptions to succeed. I don't see a way to pass through the authorization header to the remote schema.
It would seem I should use
where we had access to the context and could add properties to In the executor I have access to the context but do not see a way to set them into an object that will be passed to the remote schema. Currently I've hacked them into the extensions object but I'm sure that's not appropriate. I'm wondering what is the correct approach for this pattern. In all the relevant examples the token is either static or can be generated with no other context. In my case this client is a relay and just needs to pass along what is passed in. Would it be more appropriate to have a
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
If you need a different token for each execution, then the If my understanding is not flawed, this is exactly what the middlewares do in |
Beta Was this translation helpful? Give feedback.
-
Awesome, thanks! |
Beta Was this translation helpful? Give feedback.
If you need a different token for each execution, then the
extensions
field is the way to go. This would be the most effective, and spec compliant, approach of connecting a token to an operation.If my understanding is not flawed, this is exactly what the middlewares do in
subscriptions-transport-ws
, they inject/modify the operation execution parameters (see here).