Update the useEffect in your UserContextProvider to clear the user when the isAuthorized state changes to false, you're already handling the true condition.
useEffect(() => {
if (isAuthorized === true) {
get_user();
} else {
setUser(null);
}
}, [isAuthorized]);