Skip to content

User object is empty #2762

Sep 14, 2021 · 6 comments · 12 replies
Discussion options

You must be logged in to vote

I figured it out, and it's completely my mistake, the problem actually lies in my mind. I thought that when we return a user object, it doesn't matter which properties the object has. But it does! Because this:

async authorize(credentials) {
        const user = {
          _id: "612b4646c41e9e9f5068727a",
          password: "Test123456789",
          username: "admin",
        };
        return user;
      },

makes the user object inside session empty:

{
    "user": {},
    "expires": "2021-10-15T11:28:24.085Z"
}

But, when we use the predefined names of properties:

async authorize(credentials) {
        const user = {
          _id: "612b4646c41e9e9f5068727a",
          email: "email@te…

Replies: 6 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
12 replies
@choutkamartin
Comment options

@ical10
Comment options

@siddhantgithub
Comment options

@NkFab
Comment options

@Nelio-Bila
Comment options

Answer selected by choutkamartin
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
question Ask how to do something or how something works incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help.
Converted from issue

This discussion was converted from issue #2757 on September 15, 2021 11:36.