<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z000073C9N8CAKOkta Classic EngineSingle Sign-OnAnswered2023-05-16T02:21:12.000Z2021-07-02T05:44:51.000Z2021-07-07T00:59:50.000Z

EmmetM.20005 (Customer) asked a question.

OIDC Federated apps across multiple domains prevented by browser third party cookies rules

Hi,

 

I have multiple client apps that sit on different domains. Each client app is setup as its own OIDC client in Okta, and so should be able to use the Authorization code flow to get new tokens when required given a current okta session is valid. However given the new rules on 3rd party Cookies in browsers, this concept seems impossible to implement now. Yes custom domain is an option provided, however this does not help federated apps that sit on different domains, as the IDP can only be on one custom domain.

 

I have read alot about this and found this previous question, which is closed without an actual answer to the question https://support.okta.com/help/s/question/0D51Y00009mOYlQSAW/single-signon-across-multiple-domains-by-disabling-third-party-cookies-using-oktaauthjs?language=en_US .

 

And as mentioned in Okta docs here https://support.okta.com/help/s/article/FAQ-How-Blocking-Third-Party-Cookies-Can-Potentially-Impact-Your-Okta-Environment the line "Note: In the event that you have multiple applications running on separate domains, all of which rely on a single Okta tenant for authentication, the best course of action will be to convert your applications to use a Federation protocol like OpenID Connect (OIDC). You can learn more about OIDC in our developer docs: https://developer.okta.com/docs/concepts/oauth-openid/", doesn't actually explain how to implement this "the best course of action".

 

Could the community get some clear clarification and clear solution on how client apps on different domains can federate via OIDC?

 

Thanks


EmmetM.20005 likes this.
  • It's the widget itself - the default SPA configuration leads to a flow that looks like this:

    1. User enters in their password/mfa/etc using the widget, which talks to our AuthN APIs
    2. Once that is complete, the widget gets a sessionToken
    3. This sessionToken is then passed to our OAuth endpoint using a hidden iframe, which is the point where the user's session cookie is set

    In this flow the session cookie is set in the iframe, which is what "disallow third party cookies" disables. When the widget later tries to refresh tokens (which I'm guessing is where your developer saw that error), the session won't be set.

    There are two options:

    • Tell users that they need to enable third party cookies. We don't really recommend this anymore (and will probably change the default in the widget away from this) because it's becoming the default in many browsers - for example, this is the default in Safari today.
    • Use the redirect option - instead of silently opening the hidden iframe and exchanging the sessionToken in the same page, the widget will do a redirect to our OAuth /authorize endpoint, session cookie gets set in a first-party context, and then Okta will redirect back to your app. You can do this by setting authParams.display to page (as described here).

     

    Expand Post
  • EmmetM.20005 (Customer)

    @tiberiu.mocanu1.5700144447345728E12 (Vendor Management)​ Sorry I didn't specify, I am not using the Okta Widget. This is a custom login UI purpose built by us, that uses the Okta APIs in the same way your widget does. We Auth the customer using AuthN APIs, we exchange the session token and so a Okta session cookie (sid) is set in the users browser.

     

    We then federate to a second APP, and this second APP needs to get new tokens silently. So as a registered OIDC client they launch a hidden iframe and kick of the Auth Code flow. HOWEVER, performing this flow within an Iframe is not possible because when we redirect to the Okta Domain /Authorize call, the SID cookie (seen as a third party cookie) isn't sent due to browser third party rules within an iframe. So I was wondering if Okta knew of any around this issue within an iframe?

    Expand Post
This question is closed.
Loading
OIDC Federated apps across multiple domains prevented by browser third party cookies rules