How Can I Use Replit Auth In HTML For Validiation

I was making an HTML site, when I encountered an issue. I have a site thats in development, and I have another html file in the project. I want to use repl auth to make it so that you login with a button and if you are one of a certain amount of users (or just 1 is fine) it will bring you to the in development page, but otherwise, you will stay in the in-dev screen. Don’t know if I explained this the best, but if anyone knows how to do this, this would help me out SO much!

Hi @cheez6784 thanks for your post and welcome to the community!

Have you looked at the docs section for Replit Auth? https://docs.replit.com/hosting/repl-auth-sidebar

It has examples for use in a variety of languages.

Hope this helps!

1 Like

Welcome to the community! A quick search on Replit pulls up several templates for this. Several of them are for web-based stuff (NodeJS and Python Flask). Maybe one of them could help you. If you don’t know NodeJS or Python Flask, I reccomend NodeJS as I’ve found you can ignore the NodeJS part and use the Repl like you would a normal HTML/JS/CSS Repl.

I’ve looked at the examples, and they show me how to get user data, which I can do, but how could I filter the data so that some people can get redirected to another page, but others stay on the page. The html example also refused to connect…

I’ve looked at one of them, but i’m not sure what to do with it. Is there any project with this kind of code specifically? The only ones I found don’t make sense to me due to my inexperience with html and javascript. If you know anything like this, that would help a lot!

So you have actually inspired me to learn something new: account systems. Since I know precious little JS, I used Python Flask, but I got an account system working. Click here to view a working account system with an admin page for verified Replit Auth users.

How it works

main.py runs the server.
If the Replit username (after auth) is in the list in “projectData.py”, then they go to a separate page. If not, they go to the normal page.
account.html is the account page, and success.html is the page for successful Replit auths that are not in the account system.
You (@cheez6784) are the only person other than myself in the account system. I put you there so that you could see for yourself.
Please note that when adding to the list, you MUST add a comma between names. If you would like I can make this a text file instead (with a name on each line).

Thanks for giving me a reason to try this!

Okay. This one is better. The link takes you to the file users.txt, which is (of course) the list of users. Simply create a new line and type the username there, hit Ctrl S, and it should update the user list (although you will have to refresh the website (not Replit) so that you can sign in). This system is case INSENSITIVE, making it easier for everyone. Once again, you (@cheez6784) are in the list of verified users so that you can see for yourself. Thanks again for asking this question as I am having fun here and learning so much just from helping you!

2 Likes

I definitely did not expect it to expand in to this, but im happy it did! Also thank you so much this looks like the exact project I need, as I have experience with python.

1 Like

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