Additional User Data in Auth

default discord avatar
Sandro Wegmann
4 weeks ago
3

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
    thisisnotchris
    3 weeks 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
    3 weeks 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!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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