hi all - not sure where to ask this ... noob playing around with react / apollo / graphcool. i have a mutation that needs the logged-in user's id. what's the easiest way to access it?
j
Jared
05/01/2019, 4:28 PM
This isn't really prisma related. But in our app, we have a basic function in the resolver to get the auth info from the request and add it to the mutation
Jared
05/01/2019, 4:29 PM
so this is something that will happen at the apollo layer
k
kshenes
05/01/2019, 4:31 PM
When the user authenticates and you generate the token, stick the ID into an in-memory map that maps token to id.
j
Jonathan
05/01/2019, 5:08 PM
Depending on your server setup, you could also attach the user object onto each request using middleware, making it available via context in your resolvers