Successfully!

Error!

Failed Cross-Domain SSO on Safari

  • Last update:  2023-12-04
  • Problem

    In cross-domain situations, when you preview a report on H5 browsers like Safari, single sign-on (SSO) fails on iOS devices, but succeeds on Android devices.

    iconNote:
    Check whether the login page on the mobile terminal is a native page or an H5 page. For a native page (not involving cross-domain), the native SSO method can be applied. For an H5 page, only regular JavaScript SSO method can be applied.

    Reason

    Cookie issues cause SSO failures.

    In cross-domain situations, Safari with high security level does not allow third-party cookies to be written by default, or only allows cookies on websites you have accessed to be written.

    Solution

    1. For the client browser, simply disable the cookie blocking function. 

     

    2. For containers in mobile apps (such as WebView), on the premise that you have your own app framework, your own developers can add two lines of code to allow the browser to accept cookies. 

     

    The code is as follows:

    NSHTTPCookieStorage *cook = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    [cook setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];

     


    Attachment List


    Theme: Deployment and Integration
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback