Code Not working when tested live

Would like to get some advise regarding this, added a custom code inside the Single Sign On Client plugin, so that the cookie called "wposso_redirect_cookie" gets created.

It seems to work fine when tested locally, but when tested live, it doesn't seem to work. Live, and local site is similar, and have the same number of plugins activated.

Code:

https://pastebin.com/dV60DgWe

Would need some advice regarding this.