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

Difficulty Accessing Authenticated User Object from Passport Middleware #818

Closed
akosyakov opened this issue Sep 11, 2023 · 3 comments · Fixed by #835
Closed

Difficulty Accessing Authenticated User Object from Passport Middleware #818

akosyakov opened this issue Sep 11, 2023 · 3 comments · Fixed by #835
Labels
enhancement New feature or request

Comments

@akosyakov
Copy link
Contributor

I'm using Passport's authentication middleware, which provides an authenticated user object on a request (Passport Middleware Documentation). I'm struggling to access this user object in services.

A potential workaround is to do a double lookup in the service based on the cookie, but I'd prefer not to. It seems counterintuitive for a library to obscure objects, especially when there's an ecosystem contributing to them. This makes integration challenging.

@timostamm
Copy link
Member

timostamm commented Sep 11, 2023

Thanks for raising this, @akosyakov. We'll address this through augmentation of the HandlerContext, see #527 and the comment collecting use cases in different frameworks.

@akosyakov
Copy link
Contributor Author

Figured out that I can use ts augmentation to add more properties and mutate context via proxies.

@srikrsna-buf
Copy link
Member

#835

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

Successfully merging a pull request may close this issue.

3 participants