check for existence of request.query and request.body before deleting token to prevent ServerError 500