Issue creating authentication

Wappler Version : 7.9.3
Operating System : windows 11 pro
Server Model: nodejs
Database Type: postgres
Hosting Type: docker localhost

Expected behavior

What do you think should happen?

When creating a login action it should authorise the login and set the login cookie

Actual behavior

What actually happens?

Login action is unauthorised and the server logs show

server-connect:router     'HTTP_IF_NONE-MATCH': 'W/"ebd-IPCVMhLpmnY08D5Xtf3PM2BIEmA"'
server-connect:router   }
server-connect:router } +0ms
server-connect:router Serving serverConnect /api/auth/auth +13s
server-connect:app Executing action step login +0ms
server-connect:app options: { provider: 'auth' } +0ms
server-connect:auth No login cookie found +0ms
server-connect:output identity: false +0ms

How to reproduce

created a security provider

{
  "name": "auth",
  "module": "auth",
  "action": "provider",
  "options": {
    "secret": "******",
    "provider": "Database",
    "connection": "mbdctest",
    "users": {
      "table": "************",
      "identity": "id",
      "username": "email",
      "password": "pass"
    },
    "permissions": {},
    "passwordVerify": true
  },
  "meta": [
    {
      "name": "identity",
      "type": "text"
    }
  ]
}

then created login action

  "meta": {
    "options": {
      "linkedFile": "/views/index.ejs",
      "linkedForm": "login_centered_form"
    },
    "$_POST": [
      {
        "type": "text",
        "fieldName": "email",
        "options": {
          "rules": {
            "core:required": {
              "param": "",
              "message": "Please enter your email."
            },
            "core:email": {
              "message": "Enter a valid email address."
            }
          }
        },
        "name": "email"
      },
      {
        "type": "text",
        "fieldName": "password",
        "options": {
          "rules": {
            "core:required": {
              "param": "",
              "message": "Please enter your password."
            },
            "core:minlength": {
              "param": "8",
              "message": "Use at least 8 characters."
            }
          }
        },
        "name": "password"
      },
      {
        "type": "text",
        "fieldName": "remember",
        "name": "remember"
      }
    ]
  },
  "exec": {
    "steps": {
      "name": "identity",
      "module": "auth",
      "action": "login",
      "options": {
        "provider": "auth"
      },
      "output": true,
      "meta": []
    }
  }
}

following this even when checking and using the argon2id encryption the system seems to fail when trying to create the login cookie or session cookie

Are you sure in the login step you selected the correct $_POST variables for username and password? In your case {{$_POST.email}} and {{$_POST.password}}

1 Like

Thank you,

you helped me resolve the issue.

it wasn't as you suggested that the email wasn't right that worked but it was due to the enrollment form insert putting a spurious character at the start of emails that didn't show up when i looked at the database results.

I accept that it was my issue in that error and its corrected and working normally now

Thank you

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.