Setcookie not working as expected

I am trying to use setcookie to set the user login.
We have a scenario where we want to test a page that is displayed based on user login.

I have tried the following but no luck. I have tried setting the same cookies from the browser (chrome) and it works fine.
Please let me know if I am missing anything.

navigate path
setCookie path cookie1=TZpRG5WIfIn/KqnclE0NOTQzNzDJq/TGRjTY97
setCookie path cookie2=“cX58F1CQYUU==”
navigate path
navigate finalpath

Any help will be really appreciated.