Login using external database

Hello.
I created a custom login form without the login form members provided by Wix as shown below. I didn’t use the default one because I didn’t want it to add the credential on Wix members (because it’s just a dummy website). I also connect a database that contains the username and password. I want the form to validate it, if the username and password didn’t match, the login button won’t work, and if it matches, I want the login button to direct it to the dashboard page. Is it possible to do such things in Wix?


I tried to use lightbox and followed this tips [https://community.wix.com/velo/forum/coding-with-velo/login-to-website-using-custom-database/dl-13932777-2ca8-392a-9435-245c307236df]((https://community.wix.com/velo/forum/coding-with-velo/login-to-website-using-custom-database/dl-13932777-2ca8-392a-9435-245c307236df") , however it still didn’t work. Is there anything wrong with my codes?
Additional information :

  1. I use AWS RDS External database, my database name is mysqldemobca

  2. The collection’s name on my wix site is demo-bca

  3. The table’s name on my database is login

  4. the credential of user is restore in login table

  5. I write the code in lightbox page javascript
    My code and database’s name :

I haven’t done it using an external database, but I have done it using third party.

Do you happen to know where it goes wrong for you? are you successfully getting the password from your external database?

I think I’d also move the log-in process to the backend in a .jsw file, then if successful you can use generateSessionToken() to generate a token that you return to the front-end, then use applySessionToken() to log the user in.

I think that the code couldn’t read or fetch any data from my database, I tried to use Wix data collection feature (internal database provided by Wix), however, it still didn’t work. The lightbox’s error message says that no email matches any account. It still connects or reads an actual email that adds in site member, not the database I want.

I’m sorry for not being clear enough. I want the user to log in with the credential on my databases without I have to add them to my site members. At the very last, I want the site member to synchronize with my database, therefore I tried to make them registered through sign up lightbox (so their account will shows up on my site member), but their credential couldn’t be written on my database. Is it because I use external database, so it couldn’t be written on (even though, I already set up the database permission to allowed anyone write on my database) or there’s a problem with my code?