"Third-party cookies": setting a.com's cookies via b.com's screen

I'm trying to create something like third-party cookies.

I understand this involves setting a.com's cookies via b.com's screen.

However, it seems like getting/setting a.com's cookies can only be done on a.com's screen. When you are on b.com's screen, there is no way to get/set a.com's cookies. I tried exposing an API on a.com which allows getting/setting of a.com's cookies, then calling this API in b.com's Preparation. This apparently doesn't work.

How is this done everywhere else? How does Facebook/Google do it? Do we get/set a.com's cookies via an iframe in b.com? Do we redirect b.com's user to a.com, get/set a.com's cookies, then redirect back to b.com?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.