Replies: 3 comments 3 replies
-
As in any other GraphQL library 😉 There are hundreds if articles about that |
Beta Was this translation helpful? Give feedback.
-
I feel pretty stupid now, but I haven't found something that'd fit my needs/addresses this in a way Type-Graphql could handle; Can you maybe point me into the right direction here? |
Beta Was this translation helpful? Give feedback.
-
I know that I can authenticate for example via a JWT and through using some NodeJS Middleware I can inject the user object into my request object. The Client needs to send that JWT along with every request to the server. Now I've read that part on JWTs on Authorization (https://typegraphql.com/docs/authorization.html) and that with the Authorization decorator can limit that only logged in users, and users with specific roles, can see/query specific fields. Now the point I'm having trouble with is how to actually define a query and access my current User object, for example "req.user" inside a query.
I'm still rather new to the GraphQL Ecosystem, so I'm at a blank on where to get my "curUser" object from. |
Beta Was this translation helpful? Give feedback.
-
Describe the issue
I've been looking through the Docs and I may have missed a pretty big part but - How is Authentication handled in Typy-Graphql?
For example Logging in/out (Sending Headers/JWT/etc from the frontend back to the server with each query), and how do we access the currently logged in user in a query to, for example, only show x data they're allowed to see (not based on roles, but maybe only Data they created), or in mutations to add a CreateBy/ChangeBy when creating or modifying some data through mutations?
Beta Was this translation helpful? Give feedback.
All reactions