New method handle_unauthorized to achieve DRY