Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authrization via context #6

Open
vladimirmyshkovski opened this issue Sep 10, 2023 · 2 comments
Open

Authrization via context #6

vladimirmyshkovski opened this issue Sep 10, 2023 · 2 comments

Comments

@vladimirmyshkovski
Copy link

vladimirmyshkovski commented Sep 10, 2023

I have implemented NestJS connection to tRPC 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 and mutation, but I don't in createContext.

@medv
Copy link

medv commented Sep 21, 2023

@vladimirmyshkovski how did you go with this? Actually got to the same exact point and found this repo 😅

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

return {
...userProvidedContext,
resolveNestDependency,
};

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

@macstr1k3r
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants