Diagnosing Safari ITP‑Triggered Authentication Loss
When Safari logs users out after navigation, ITP may block the auth cookie. This guide walks through detecting the issue, interpreting cookie attributes, applying fixes, and knowing when to file a WebKit bug.
29 Mar 2026, 17:40 UTC

Recognizable Condition
Users report being logged out after leaving a page and returning, or after a full page reload. In Safari 17+ the Web Inspector console shows messages such as Cookie blocked due to ITP for the session or authentication cookie.
Cause & Diagnostic Table
Safari’s Intelligent Tracking Prevention (ITP) treats cookies as third‑party under several conditions. The following table maps common cookie attributes to ITP behavior:
| Attribute | Value | ITP Handling |
|---|---|---|
| SameSite | None | Allowed only if Secure is present |
| SameSite | Lax/Strict | Allowed when set by first‑party origin |
| Secure | Missing | Blocked if SameSite=None |
| Domain | Sub‑domain not listed as first‑party | Partitioned or blocked |
| Redirect Flow | Cross‑domain redirect sets cookie | Cookie treated as third‑party |
Ordered Checks
- Open Safari’s Develop Menu
- Enable Develop > Show Web Inspector if not already active.
- Navigate to the site’s login page and log in.
- In the Inspector, click Storage > Cookies and locate the authentication cookie.
- Note the
Domain,SameSite,Secure, andHttpOnlyflags.
- Check the Console for ITP Warnings
- Look for messages like
Cookie blocked due to ITPorCookie not sent in request.
- Look for messages like
- Verify Network Requests
- In the Network tab, find the request that should carry the session cookie (e.g.,
/api/user). - Inspect the
Cookieheader to confirm the cookie is present.
- In the Network tab, find the request that should carry the session cookie (e.g.,
- Temporarily Disable ITP
- In the Develop menu, go to Experimental Features > Disable Intelligent Tracking Prevention.
- Reload the page and repeat the login flow.
- If the issue disappears, ITP is the root cause.
Fixes Tied to Findings
- SameSite=None without Secure
- Update server‑side cookie creation to include
SecurewhenSameSite=Noneis used. - Example
Set‑Cookieheader:Set-Cookie: session_id=ABC123; SameSite=None; Secure; HttpOnly; Path=/; Max-Age=3600
- Update server‑side cookie creation to include
- Cross‑domain Redirect Flow
- Re‑architect the login to avoid setting the auth cookie on a redirect to a different domain.
- Alternatively, use the Storage Access API to request permission for the third‑party origin.
- Example JavaScript snippet:
document.requestStorageAccess().then(() => { // Retry login or reload the page });
- Sub‑domain Cookie Domain
- Set the cookie domain to the registrable domain (e.g.,
.example.com) instead of a sub‑domain. - Example:
Set-Cookie: session_id=ABC123; Domain=.example.com; SameSite=Lax; Secure; HttpOnly
- Set the cookie domain to the registrable domain (e.g.,
- Use CNAME for First‑Party Sub‑domains
- Configure a CNAME record that maps the sub‑domain to the main domain, allowing Safari to treat it as first‑party.
- Verify that the
Domainattribute in the cookie matches the CNAME target.
Verification After Fix
- Clear Safari’s cookies for the site (Develop > Disable Caches or manually remove from Storage).
- Reload the login flow and observe the Console for any remaining ITP warnings.
- In the Network tab, confirm the
Cookieheader contains the session cookie on subsequent requests. - Optional: Use
curlto inspect the server’sSet-Cookieheader:
Check forcurl -I https://www.example.com/loginSameSite=None; Securein the response.
Escalation Criteria
If, after applying the fixes above, the issue persists for more than 10% of users or appears across multiple unrelated sites, consider the following steps:
- File a detailed bug report with WebKit at bugs.webkit.org, including:
- Safari version (e.g., 17.0)
- Reproduction steps and screenshots
- Cookie attributes and ITP warnings
- Server code snippets setting the cookie
- Contact Apple Developer Support for guidance on ITP changes in upcoming releases.
- Subscribe to the WebKit ITP release notes to monitor policy updates that may impact your site.
Practical Takeaway
Intermittent logouts in Safari are often the result of ITP blocking the authentication cookie. By inspecting cookie attributes, confirming ITP warnings, and ensuring SameSite=None is paired with Secure, you can restore stable sessions. If cross‑domain redirects are unavoidable, leverage the Storage Access API or restructure the flow to keep the cookie first‑party.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.