Open vladimirmyshkovski opened 1 year ago
@vladimirmyshkovski how did you go with this? Actually got to the same exact point and found this repo :sweat_smile:
edit: return req here, then you should have access to req.headers in context - or handle it further upstream through passport etc and access req.user https://github.com/macstr1k3r/trpc-nestjs-adapter/blob/aa7e5f74dde97ac1b76e361dc5f4456ad3744ef2/src/lib/build-trpc-nest-middleware.ts#L38-L41
as a sidenote, the npm package seems to have been published much more recently, at the very least there are new methods on the context object that are not passed in the above link. Any chance of getting a more recent push @macstr1k3r? Thank you for trailblazing this
@medv @vladimirmyshkovski I pushed everything I have, albeit it's not a lot.
I haven't had the need to auth so far (was handled elsewhere). I'll slowly be dipping my feet into that part in the near future and will report back.
I have implemented
NestJS
connection totRPC
without your adapter, and found your solution looking for a way to authorize via context, but I see that you don't have it in your example either. Perhaps you have some ideas?I, just like in your implementation, albeit in a different way, have access to services to call them in
query
andmutation
, but I don't increateContext
.