このシナリオでは、SAA が権限プロンプトをトリガーするため、ユーザーは 2 つの異なるプロンプト(1 つは認証用、もう 1 つは Cookie アクセスの許可用)を承認する必要があります。FedCM は、信頼シグナルとして機能することで、Storage Access API プロセスを簡素化します。ユーザーが FedCM でログインすると、IdP が開始したストレージ アクセス リクエストが自動的に承認され、追加の SAA プロンプトの必要がなくなります。
// In top-level rp.example:
// Ensure FedCM permission has been granted. const cred = await navigator.credentials.get({ identity:{ providers:[{ configURL:'https://idp.example/fedcm.json', clientId:'123', }], } });
// In an embedded IdP iframe:
// Returns `true` if the user already has access to cookies, and `false` if // the user doesn't have access yet and needs to request it. const hasAccess = await document.hasStorageAccess() if(!hasAccess){ // No user gesture is needed to approve storage access, and the call will be auto-granted. document.requestStorageAccess().then(e=>{ //access cookies }) }else{ //the iframe already has access to third-party cookies }
オリジン トライアルの参加者は、一般的な Storage Access API プロンプトよりもコンテキスト固有の FedCM プロンプトによってユーザー エクスペリエンスが向上したことを評価しています。
[null,null,["最終更新日 2024-11-15 UTC。"],[[["Chrome now uses FedCM as a trust signal for the Storage Access API, streamlining cross-origin iframe storage access when users are logged in with FedCM."],["This integration eliminates the need for separate Storage Access API prompts, simplifying the user experience and reducing prompt fatigue."],["Websites using both FedCM and the Storage Access API benefit from this feature, as users only need to authenticate once with FedCM for both login and storage access."],["Developers can learn more about implementation and feedback channels through provided documentation and issue tracking links."],["Positive feedback from origin trial participants suggests that FedCM-based storage access improves user experience compared to generic prompts."]]],["Chrome 131 utilizes FedCM as a trust signal for the Storage Access API (SAA). When a user logs in via FedCM, storage access requests from Identity Providers (IdPs) are automatically granted, removing the need for additional SAA prompts. Websites using both FedCM and SAA see streamlined access. Without FedCM, the user needs to approve separate prompts for authentication and cookie access. `document.requestStorageAccess()` becomes auto-granted, and cookies will be available. If `navigator.credentials.preventSilentAccess()` is called, storage access is not granted until reauthentication.\n"]]