Skip to content
← Back to Community
Is there any way to authenticate repl.it users in React?
Profile icon
MatthewDoan1

Basically the title. I see repl.it auth being used mainly on the server-side, but is there any way to use it on the client-side with ReactJS?

Voters
Profile icon
ironblockhd
Profile icon
GayGuyMcGee
Profile icon
MatthewDoan1
Comments
hotnewtop
Profile icon
ironblockhd

It is possible with fetch and localStorage, here's an example in express: https://repl.it/@ironblockhd/clientsideAuth#index.js

Profile icon
MatthewDoan1

@ironblockhd Ah, beautiful example. Thank you so much!

Profile icon
Coder100

hmm you still need a backend @ironblockhd

Profile icon
ironblockhd

I think he has a express backend so it's working for this specific question, i agree that the name of my repl is chosen poorly

Profile icon
MatthewDoan1
Profile icon
Coder100
Profile icon
MatthewDoan1

@ironblockhd Hm, it doesn't work inside a React component.
image

Profile icon
ironblockhd

I modified my repl in a way it should work with react, you will need to change the buttonn as specified here: https://reactjs.org/docs/handling-events.html

Profile icon
PattanAhmed

@MatthewDoan1 Hi,
You will also need Front-End and Back-End

(IG)

React.js is just Front-End and you need Back-End like HTML, Python, etc.

Hope this helps
Please mark my answer if this helps

Profile icon
Coder100

sorry, that is not possible, you will need a backend to parse the header.

Profile icon
MatthewDoan1

@Coder100 Yea, I'm using an Express backend right now, just for an API to connect to a database (Firestore). I don't want to go through all the redirects and stuff because my app is an SPA. is this still possible?