Skip to content

Payload.autheticate middleware returns undefined for req.user on collections that aren't in config.admin.user #1384

Answered by jmikrut
paper-krane asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @paper-krane — thank you for this report and for your compliments regarding Payload! We're pumped you found us and we have lots more to come.

So, your understanding is correct. payload.authenticate will work for any collection (not just the one that is used to sign in to the admin UI.

I recreated your test environment and I found that your login route actually was not working. I needed to add router.use(express.json()) immediately after the payload.authenticate middleware, at which point, it now works.

However, I'm not able to test the full frontend admin UI workflow, because I don't have your login or account views.

So I am thinking that the above addition of express.json() works, th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@paper-krane
Comment options

Answer selected by zubricks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
2 participants
Converted from issue

This discussion was converted from issue #1355 on November 12, 2022 19:09.