Interfejs Storage Access API (SAA) umożliwia elementom iframe w różnych domenach żądanie uprawnień dostępu do pamięci masowej, gdy dostęp zostałby odrzucony przez ustawienia przeglądarki.
Niektóre witryny mogą używać zarówno FedCM do uwierzytelniania, jak i SAA, aby umożliwić elementom iframe z różnych domen dostęp do wymaganego miejsca na dane. Jeśli na przykład idp.example jest umieszczony w rp.example, a idp.example potrzebuje dostępu do plików cookie na poziomie usługi pamięci masowej, aby wyświetlać treści spersonalizowane.
W takim przypadku użytkownik musi zatwierdzić 2 różne prośby: jedną dotyczącą uwierzytelniania, a drugą – przyznania dostępu do plików cookie, ponieważ SAA wywoła prośbę o zgodę. FedCM upraszcza proces Storage Access API, działając jako sygnał zaufania. Gdy użytkownik zaloguje się za pomocą FedCM, żądania dostępu do miejsca na dane inicjowane przez dostawcę tożsamości zostaną automatycznie przyznane, co eliminuje potrzebę wyświetlania dodatkowych monitów SAA.
// In top-level rp.example:// Ensure FedCM permission has been granted.constcred=awaitnavigator.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.consthasAccess=awaitdocument.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}
Uczestnicy trybułu Origin pozytywnie ocenili prompt FedCM w kontekście, który jest lepszy od ogólnego promptu interfejsu Storage Access API.
Więcej informacji o używaniu FedCM do automatycznego przyznawania dostępu do miejsca na dane znajdziesz w dokumentacji API Storage Access.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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"]]