What is your trigger for changing the user's authorization? If you're saying that you're opening your database client (Say for example MySQL or PostgreSQL) and manually changing the authorization for the user, then there's no way your server or your client to know of that change (As far as I know at least) and they cannot react to that particular change.
If your trigger was some request sent by the user, say
change authorization, then you should respond with the new token for that particular request and store it, easy peasy.
If your trigger wasn't related to your client, and it's somehow something happening on your serverside, then you should have a socket opened between your server and your client, and emit that change from your server to your client.
That way you ensure the client is always up-to-date.
But that's still not enough, because yeah you're keeping the client up to date, but what if he saved the token and replaced it after your update? He/She can still access admin features even though you told them they're just normal users. For that you're gonna need to validate every request done by any of your users, and check if they're allowed to make that request in the first place.
You cannot really trust clients. You should find a way to invalidate your jwt tokens. Your client should get a new token when you reject them. You can rotate your tokens using refresh key.
In order to do that:
- Keep your token lifetimes short
- Store blacklisted tokens in the database and reject the invalidated tokens.
- jwt token how to ensure the payload is updated when database change
- How do you change parent's state from child when the state is a database table?
- In Firebase when using push() How do I get the unique ID and store in my database
- how to rerender a component when hash change and change the state
- How to change the style of one element when I hover another element (ReactJS)?
- How to implement remember me functionality for authentication in ReactJS when i only receive jwt token from backend api
- p5.js and React: how to update a sketch inside a component when one of the component's props is updated
- How to change the background-color when scrolling?
- React - How to change code written in the old way when using a new approach?
- How to stop re-rendering a whole list of items when only one item of the list is created or updated in ReactJs React-Redux?
- How can I change the checkbox styles and icons when hover on it in Material-UI React?
- How to change the data stored in LocalStorage when clicking on element in react?
- React Hooks: Idiomatic way to ensure that useEffect runs only when the contents of an array argument to the custom hook change
- How can I change remove the filter icon when using the material-table library?
- how to change background color when I click the button using react hooks
- How to ensure when content pasted in forms, the forms values updates immediately?
- React.js: How to change icon when item in the list is clicked?
- How to change the content inside an ace editor when I clicked on another file?
- How can i change the error message in Firebase? For example, when invalid password is entered?
- How do i change the color of a button when clicked in react?
- How to change the button colour when it is clicked
- How to change the background or text color of the countdown timer to green when there is only 30 minutes remaining to finish the countdown?
- How do I re render the entire React Pivot Table UI component when I change the selection in select tag?
- how to change the style of only one react component that is being render through .map() when the component is clicked
- When I click on a link, how can I change the status of another component?
- How to change the state object when one of the fields is an array?
- When selecting an option in a dropdown, how do I change the state with onChange but with a value other than the one inside the option tags
- How to change the state of the particular component when it is clicked, using useState in react js?
- How to change the nav bar color when it reaches the next div
- How to change the state when going to previous or next page with React?
More Query from same tag
- Rx.js React extension testing stream and intermediate results
- Exclude specific file from webpack bundle
- ReactJS/JestJS/Enzyme: How to test graphql() function used in compose()?
- Adding html class in react dynamically using function?
- Adding a <strong> Tag to the typed letters in Autocomplete field in React
- Refer to primitive DOM element class
- Refactoring class component to functional component with hooks, getting Uncaught TypeError: func.apply is not a function
- How do I trigger my redux function in my component
- Make a logger for Node Js
- Why is page content not showing in react-router-dom v6?
- Getting this warning "Functions are not valid as a React child"
- Changing size of a textbox in html string in React
- ReactJs Accordion Automatic Close Mechanism
- React leaflet Marker title doesn't update
- How to send array of object in post request using axios library
- how i can render directly my menu when my local storage is not null?
- Redux how to get updated store state in root component
- How exactly is React's Virtual DOM faster?
- How to map converted time as a string in React
- Why set property equal to itself in DOM render - React.js
- ReactJs: How to use refs in stateless component
- React- How to pass props between two different Microfrontent component
- React Router 4 triggering full page reload
- React app failed to load config "airbnb" in deploying to heroku
- how do you make a request from client to server locally using fetch without getting an opaque response?
- How to set interval in useEffect in React Functional Component
- Suspense and lazy load a modal in Material-UI
- React state always returning previous (or initial) state inside callback from fabricjs
- plz help for aws ec2 react+node build error