Skip to content

Update sample to deal with stricter browser vendor rules for third-party cookies #40

@jeroenheijmans

Description

@jeroenheijmans

Browser vendors are implementing increasingly strict rules around cookies.
This is increasingly problematic for SPA's with their Identity Server on a third-party domain.
Most notably problems occur if the "silent refresh via an iframe" technique is used.

This repository uses that technique currently, starting with a silentRefresh().
This will fire up an iframe to load an IDS page with noprompt, hoping cookies get sent along to so the IDS can see if a user is logged in.

Safari will block cookies from being sent, prompting a leading OAuth/OpenID community member to write "SPAs are dead!?".
In fact, if you fire up this sample repository on localhost, which talks to demo.identityserver.io (another domain!), and use it in Safari: you will notice that the silent refresh technique already fails!

Edit: starting with Chrome 83, they also have this behavior in Incognito mode.

Several prominent directions for solving this are available, and more too possibly:

  1. Run IDS on a subdomain where your SPA is also running (effectively making cookies first-party)
  2. Don't use "the iframe technique", but instead use refresh tokens with additional mitigations
  3. Switch to a BFF (Backend-for-frontend) setup

I'm not sure yet what route to pick for this sample, if any.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementRequest for improvementinvestigation-neededIssues requires further investigation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions