fix api to handle unauthorized(401) callback