Description
Problem:
A common pattern in authentication is visiting the IDP in a first party context (authentication) and then being redirected to the relying party. The relying party then embeds iframes of the IDP to finish authentication (in the scenario where it requires multiple access tokens). It uses those iframes over the lifetime of the application running, potentially days, refreshing tokens every time they expire (usually every one hour). Example applications that are used all day: Outlook Online, Teams. This is known as the implicit flow problem, a general pattern broken by 3p cookie removal.
Applications can update to support bespoke, per-IDP protocols that trigger the storage access API, in order to fix this iframe-based auth. This introduces additional friction for the user and the developer - the user must finish signing in, be sent to the relying party, and then find and click another button within the application to "really finish" signing in.
Existing similar behaviors:
Firefox has a heuristic today that unblocks (temporarily -15 minutes) storage access if the embedded frame received interaction immediately prior to redirecting to the relying party. This heuristic allows an application to successfully complete authentication using iframes, but the app will break if they require tokens after 15 minutes. This creates an unfortunate experience for the user - their application navigates to the IDP every hour when tokens expire, disturbing their ability to use the app.
Proposal:
The IDP, today, knows if the relying party requires 3p cookie access to the IDP, and knows the redirect URI for the application. The IDP should be allowed to trigger a storage access prompt, indicating that it will need storage access while embedded on the domain of the application being signed into. As part of triggering this prompt, the IDP provides the redirect URI that it will navigate to next. After the user accepts the prompt, the IDP must navigate to the promised redirect URL. If it does not, the browser does not grant the storage access.
Note: it would be additional work and ossification to have the storage access prompt trigger the redirect. The redirect can be done via POST, JS, or 302. State tracking and redirect detection may be easier than providing an API that specifies exactly how that redirect occurs.
This allows identity ecosystems to self-repair after 3p cookie disappearance without updates to applications.
Example:
ComplexApp.example uses multiple iframes, and embeds apps that also use iframes, to authenticate with idp.example. When a user visits complexApp for the first time, they are unauthenticated. The app redirects the user to idp.example, with the following query string: ?client_id=abcd&redirect_uri=https://complexapp.example/oauth2
.
The IDP authenticates the user, and immediately prior to redirecting the user to complexApp, checks the app registration for app abcd. Because abcd is registered to use the implicit flow, the IDP knows to prompt for storage access.
The IDP makes a JS call to the Storage access API: requestStorageAccessForRelyingParty("https://complexapp.example/oauth2");
The browser prompts the user, potentially using the scenario as a hint to inform the user that this is for login: Are you ok with idp.example tracking your visit to complexapp.example?
The browser does not immediately grant the storage access, but waits to see if the IDP redirects the user to the provided URL. If the IDP does, then storage access is granted. If not, then the Storage Access grant is not provided.