# Protecting Static Website using Auth0 but using existing users

**URL:** <https://community.auth0.com/t/protecting-static-website-using-auth0-but-using-existing-users/76359>\
**Category:** Get Help\
**Tags:** auth0-spa-js, login, auth0\
**Created:** [January 13, 2022, 2:58pm UTC](https://community.auth0.com/t/protecting-static-website-using-auth0-but-using-existing-users/76359 "2022-01-13T14:58:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dheerajdhall2709](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dheerajdhall2709/32/13346_2.png) [@dheerajdhall2709](https://community.auth0.com/u/dheerajdhall2709)\
**Post date:** [January 13, 2022, 2:58pm UTC](https://community.auth0.com/t/protecting-static-website-using-auth0-but-using-existing-users/76359/1 "2022-01-13T14:58:18Z")

</div>

Hello. I am trying to protect a static website by using auth0 and I am utilizing the **auth0-spa-js** to do this, this one to be exact - [Auth0 JavaScript SDK Quickstarts: Login](https://auth0.com/docs/quickstart/spa/vanillajs/01-login)

I was able to get the login page to show up but for users that have a DB **connection** it fails to login. I realized this is because, it is sending **username-password** as the connection in the payload instead of resolving it based on user. How would I go about fixing this?

auth0-spa-js

- **SDK Version:** 1.13
- **Platform Version:** express

---

<div class="post-metadata">

**Author:** ![dheerajdhall2709](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dheerajdhall2709/32/13346_2.png) [@dheerajdhall2709](https://community.auth0.com/u/dheerajdhall2709)\
**Post date:** [January 13, 2022, 5:03pm UTC](https://community.auth0.com/t/protecting-static-website-using-auth0-but-using-existing-users/76359/2 "2022-01-13T17:03:22Z")

</div>

I figured it out. Used the constructor for **Auth0Client** and provided connection as an argument.

[https://auth0.github.io/auth0-spa-js/classes/auth0client.html#constructor](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#constructor)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 28, 2022, 5:04pm UTC](https://community.auth0.com/t/protecting-static-website-using-auth0-but-using-existing-users/76359/3 "2022-01-28T17:04:20Z")

</div>

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