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

req.user vs req.user #1493

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

req.user vs req.user #1493

wants to merge 2 commits into from

Conversation

sjvans
Copy link
Contributor

@sjvans sjvans commented Dec 3, 2024

re #1483

@sjvans sjvans marked this pull request as ready for review December 3, 2024 13:05
@sjvans sjvans requested a review from smahati as a code owner December 3, 2024 13:05
@sjvans sjvans mentioned this pull request Dec 3, 2024
::: tip
Please note the difference between `req` in a service handler (instance of `cds.EventContext`) and `req` in an express middleware (instance of `http.IncomingMessage`).
Case in point, `req.user` in a service handler is an official API and, if not explicitely set, points to `cds.context.user`.
On the other hand, setting `req.user` in a custom authentication middleware is deprecated.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you generally discourage the use use of req.user in middleware or only for setting properties?

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

Successfully merging this pull request may close these issues.

2 participants