Undefined property: stdClass::$identity

Our login no longer works.

Anyone know what could be wrong?

Do you have selected a column for Identity under Users & Permissions in the Security Provider. The error tells that the Identity option is undefined.

yes, the identity field is specified.

Could you open it in code view and post the code here.

$exports = <<<'JSON'

{

  "name": "security",

  "module": "auth",

  "action": "provider",

  "options": {

    "secret": "***",

    "provider": "Database",

    "connection": "db",

    "users": {},

    "permissions": {

      "Kunde": {

        "table": "user",

        "identity": "userID",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "k"

          }

        ]

      },

      "Dienstleister": {

        "table": "user",

        "identity": "userID",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "d"

          }

        ]

      },

      "Freelancer": {

        "table": "user",

        "identity": "userID",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "f"

          }

        ]

      },

      "Location": {

        "table": "user",

        "identity": "userID",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "l"

          }

        ]

      },

      "Admin": {

        "table": "user",

        "identity": "userID",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "a"

          }

        ]

      },

      "SuperAdmin": {

        "table": "user",

        "identity": "userID",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "sa"

          }

        ]

      },

      "Logistik": {

        "table": "user",

        "identity": "userid",

        "conditions": [

          {

            "column": "role",

            "operator": "=",

            "value": "lo"

          }

        ]

      }

    },

    "passwordVerify": true,

    "domain": "***",

    "secure": true

  },

  "meta": [

    {

      "name": "identity",

      "type": "text"

    }

  ]

}

JSON;

It somehow lost the database fields information, "users": {} should be an object with all the database fields.

Did the schema of the database change? I see you use userid as identity while in the permissions it is userID. Try making a change, save the file, then change it back again and save again. See if that fixes the file.

  • In the taget development “Local server” I first changed it to name and then to userid.
  • In Target Online, is it as userID again.
  • I cannot adjust directly here because there is no direct Online-DB connection.
  • I then tried changing and saving it in codeview, but it doesn’t work.

I have now deleted the security provider and created it again.-
That seems to work

I did this on a php build without issue. Now I am getting the undefined error as well on my node build.

I deleted security and set it up again and even named it something different. Here is the code view. It seems to have everything there.

Login page code

And lastly, in debug

I am not sure what else to look for where the problem is.

TIA

Hello!

Can you copy and paste here the entire error?
Seems you need to do a horizontal scroll

Thanks for helping. Here it is

“status”: “500”,
“message”: “Cannot read properties of undefined (reading ‘length’)”,
“stack”: “TypeError: Cannot read properties of undefined (reading ‘length’)\n at Object.verify (D:\xampp\htdocs\sheriffBase\node_modules\argon2\argon2.js:111:24)\n at DatabaseProvider.validate (D:\xampp\htdocs\sheriffBase\lib\auth\database.js:25:48)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async DatabaseProvider.login (D:\xampp\htdocs\sheriffBase\lib\auth\provider.js:45:26)\n at async App._exec (D:\xampp\htdocs\sheriffBase\lib\core\app.js:611:30)\n at async App.exec (D:\xampp\htdocs\sheriffBase\lib\core\app.js:547:9)\n at async App.define (D:\xampp\htdocs\sheriffBase\lib\core\app.js:529:9)”

I hope it sheds light on it.

I think what’s happening, can you show me the schema of the “role” database?
Like:
image

Here are the roles and users.

Mmm, this is strange

Are you using Argon2 for hashing password, right?

As Brian suggested. Unless I missed a note that we need to use the other. This one worked in the php build, is it different in node?

I think that there is a conflict with the “user_id” column name…
Can you chage the name in your roles table to rol_user_id and after updating the Users & Permissions try again ?

It’s OK, just asking because I see “password verify” in the code :slight_smile:

I was thinking the same but tested like that and had no issues.

I don’t think the issue comes from the users & roles.
But just to be sure:
@Richelle_Anderson can you make a succesful login if you delete all users and permissions on the security provider?
(You can duplicate security_main for backup)

Removed all the Users and Permissions in Security and have the same error. I only had two so not a big deal to add them back once it is working.

So the problem is the login step.
Your database where you have the users table is called sweb right?

Do you have only one target? Called Development?