Moralis.User.current().get('Role') returns empty object attributes

I’m trying to get the Role name for the current user client side after login with:


This is what it returns:

The attributes are empty and I can’t get the name. I’ve had some occasions where it did show up suddenly, so I’m wondering if there’s a timing issue or some promises not getting resolved.

How I’m logging in and logging the Role:

      let user
      try {
        user = await Moralis.User.current()
        if (!user) {
          Moralis.Web3.getSigningData = () => 'Log into '+process.env.VUE_APP_NAME+' with this wallet'
          user = await Moralis.Web3.authenticate()
        const role = await Moralis.User.current().get('Role')


Try to JSON.stringify() and take a look is there info you needed and then JSON.parse()

yeah so stringify only returns the objectId from the Role in the Moralis.User.current object.
My problem: I want the attributes, more specific the name. I wonder why it’s not provided. I can find plenty of workarounds but was hoping to use it straight from the user object.


just to let you know also, Moralis.User.currentAsync() does not contain any Role object or a getRole() method, whereas Moralis.User.current() does (although very limited in use, but maybe for security reasons?)