Is there any way to authenticate repl.it users in React?
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?
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
Coder100
sorry, that is not possible, you will need a backend to parse the header.
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?
It is possible with fetch and localStorage, here's an example in express: https://repl.it/@ironblockhd/clientsideAuth#index.js
@ironblockhd Ah, beautiful example. Thank you so much!
hmm you still need a backend @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
@Coder100

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

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