I want to share cookies between subdomain

Currently, we have 2 subdomains and cookies are created on their own. We are getting a loop issue in login means after completing login it is asking again for login. It might be due to cookies creating their own subdomains. So for the solution of it I want to create a sharable cookies like if subdomain is abc.xyz.com the cookies should be on xyz.com. I running the application in iFrame.
So anyone have ideas like how we can create cookies for the main domain?