Additional User Data in Auth

default discord avatar
Sandro Wegmann
4 months ago

I need to add an attribute to the user called activeSite which should be used in access control. However, it seems like by default, only user email and collection are stored in the auth object of the user.

How can I add an additional field to the auth user object?

  • default discord avatar
    4 months ago

    @Sandro Wegmann I think you need to add the saveToJWT property for the field

    To add fields to the auth token

  • default discord avatar
    Sandro Wegmann
    4 months ago

    Ah thanks a ton! I had such a property in mind but couldn’t find it anywhere 😄

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.