Skip to content
← Back to Community
Repl.it Auth with Express.js (Node.js + Express)
Profile icon
hacker
has Hacker Plan
Geocube101

Was developing a game with a node.js express framework which required a way to store scores. I decided to store them using players' repl.it names (as the game was designed to be played by repl.it users)
I came across an issue whilst creating the authentication. A can't actually test if a username exists in the repl.it database, as any url with an incorrect username Example: "https://repl.it/@completlyfake" just returns the built-in page that says 404, and XMLHttpRequests (due to security reasons) are blocked when access is attempted across domains. I was wondering if it's possible to authenticate against the repl.it user database.

Surprisingly enough, it took me like 5 attempts to find a user that didn't actually exist (there's a user called "notauser")

Answered by anishanne [earned 5 cycles]
View Answer
Voters
Profile icon
amasad
Profile icon
Vandesm14
Profile icon
Geocube101
Comments
hotnewtop
Profile icon
amasad

Why do you need to test if a username exists if you're using the automatic auth? you can be sure it exist

Profile icon
Geocube101

@amasad
Automatic Auth?
(If you're talking about the "notauser" thing I had to manually type "notauser" into the URL bar and see if a 404 page popped up)

Profile icon
anishanne

@Geocube101
Take a look at this post by
@mat1
, https://repl.it/talk/learn/Authenticating-users-with-Replit-Auth/23460. It is for python + flask but you should be able to convert it to node.js+express, if not you can always ask for help in the community.

Profile icon
Geocube101