Are there any examples of client side auth for react? Similar to https://github.com/fnakstad/angular-client-side-auth
If not, what would be a good way to handle role based showing/hiding of specific UI inside react?
There are two main things your React application needs to do to sign on a user: Get an access token from an authentication server. Send the access token to your backend server with each subsequent request.
Client-side authentication is when authentication checks are performed completely at users' side. The idea is that the authentication procedures, methods, or codes are delivered to the client, where they are executed to determine whether a user has access.
By default, your React app will be client-side rendered. This means basically, all of the source code will live in JavaScript files referenced in a single HTML file that initializes your app.
You can read a blogpost I wrote exactly about this subject :). https://auth0.com/blog/2015/04/09/adding-authentication-to-your-react-flux-app/. There's an example on Github linking from the post.
Let me know if you find it useful.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With