Storage Access API (SAA)를 사용하면 브라우저 설정에 따라 액세스가 거부되는 경우에도 교차 출처 iframe이 스토리지 액세스 권한을 요청할 수 있습니다.
일부 웹사이트에서는 인증에 FedCM을 사용하고 교차 출처 iframe이 필요한 저장소에 액세스할 수 있도록 SAA를 모두 사용할 수 있습니다. 예를 들어 idp.example가 rp.example에 삽입되어 있고 idp.example가 개인 맞춤 콘텐츠를 표시하기 위해 자체 최상위 쿠키에 대한 저장소 액세스가 필요한 경우
이 시나리오에서 사용자는 인증을 위한 메시지와 쿠키 액세스 권한을 부여하기 위한 메시지 등 두 가지 메시지를 승인해야 합니다. SAA가 권한 메시지를 트리거하기 때문입니다. 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
}
Origin 체험판 참여자는 일반적인 Storage Access API 프롬프트보다 컨텍스트별 FedCM 프롬프트로 제공되는 향상된 사용자 환경을 강조하는 긍정적인 의견을 제공했습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 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."]]],[]]