Failed Cross-Domain SSO on Safari

  • Last update:December 04, 2023
  • 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
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy