update cookie method to latest api