DEV Community

Ahmed-Mohammed-Badawi
Ahmed-Mohammed-Badawi

Posted on

Firebase Authentication problem ! help :)

Hi guys. My problem is I'm using react-router in my app to show some routes and hide some based on The Authentication State, which here is the Token but in react apps there are helper extensions that allow us to change some things in code like react extension. This means that anyone can change the authentication state from it and show the hide or disabled routs, is there any way or better way to solve this problem? thanks.

note: I'm sorry about my bad English

Top comments (5)

Collapse
 
benjioe profile image
Benjioe • Edited

Ok, when you use React, every time you need some data, you make an AJAX request (fetch) to an API (who is public). So if your API is protected with tokens, an intruder can only access some empty template.
Is-it still a problem?

Collapse
 
benjioe profile image
Benjioe • Edited

If yes, you can:

  • Make routing on server with the server-side rendering (with NextJS or ReactDomServer).
  • Maybe have 2 React application, the private one is protected on the server (using Node.js...) and you use redirections from one to other. Or maybe without redirection but something like Microfrontend.
Collapse
 
sni9er profile image
Ahmed-Mohammed-Badawi

Okay bro thanks you helped me a lot β™₯

Collapse
 
terabytetiger profile image
Tyler V. (he/him)

If you use the #help tag your post will show up to more people that may be able to assist you :)

Collapse
 
sni9er profile image
Ahmed-Mohammed-Badawi

Thank you Bro I'll do it now β™₯