Centralize cookie creation

Change-Id: I1a17416121764f33a8d05a88c80cece0c03ac41d