Replies: 1 comment 3 replies
-
I'm not sure what you mean by "proxy" here. You can use Apollo Federation for this, having a subgraph's url field using |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have setup a Apollo server to act as a primary endpoint to (for now) our Contentful GraphQL endpoint.
This proxy is aware of the calling user's role (Auth0 authorizer).
We'd like the modify / limit the
VideoPost
returned based on that role. Effectively to return anull
for theVideoPost.url
from non-premium (not logged in users) (Paywalled) We still want anonymous users to be able to query all videos... just not be able to view the video itself. Hence the idea to just returnVideoPost.url = null
.Perhaps there is a better way to do this altogether, but right now we we're just trying to proxy the resolver for
url
field like this..However,
parent
only includes what was asked for in the query.... so if the query didn't ask forparent.restrictToRoles
then we're unable to modify things cause we don't know therestrictToRoles
data on that VideoPost.Is there a better way to do this?
Been reading a lot about “delegateSchema” and “transforms”, however, I think I’m unsure as to if these ONLY deal with the “schema” and not the actual data results.
What we we’re hoping to do was to remove the Video.url from all requests or from the response if the user’s role/identity is not “premium” and the “Video.allowedRole” doesnt match.
Gist Here
Beta Was this translation helpful? Give feedback.
All reactions