I have an Angular 5 SPA and I’m trying to set things up to have a marketing page for my app on a different subdomain, but for users to be able to login or signup directly from that marketing page and then be redirected to the main app. So, for example:

And I’m trying to have it so a user can initiate the flow on the first subdomain and then be redirected and logged-in to the different subdomain.

The problem that I’m facing is that once the user initiates from the first subdomain, an error occurs when being redirected to the second subdomain:

{error: "invalid_token", errorDescription: "state does not match" }

From my understanding, a state gets generated in localStorage when first initiating the flow, but then upon redirection the state doesn’t match because the 2nd subdomain never got that state. I’m wondering if there’s any easy way around that, or if it’s just not a type of flow that’s possible to achieve?