Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-10-2022 04:16 AM
Hi,
I am using GraphQL library for Neo4j.
How can I define a property on a type (e.g. tenantId: String!) which will take its value from the 'tid' property of the jwt auth token?
I currently use a '@bind' on the $jwt.sub but ideally, the 'tenantId' field will not appear in generated queries/mutations - I'm hoping the '@computed' directive can achieve all of this but I don't see how to define the property on the type to compute the field from the jwt property...
Any help appreciated - thanks.
06-19-2022 11:52 PM
Hi Adrian!
One way that came to mind which you may be able to solve this is by using the "@callback" directive. The jwt token can then be accessed via the "context" argument (something like "context.jwt.tid"), see this example.
Would this help in your case?
06-27-2022 06:58 AM
Thomas,
Thanks! That looks like a potential solution. I think I have Apollo configured to include the jwt in the context so that may work.
I'll give it a try and update here 👍
All the sessions of the conference are now available online