升级到Mac OS X 10.15.2版后,使用google-api-javascript-client
库登录Google对某些用户在Safari中停止工作。
[Safari开发者控制台和网络选项卡并没有真正告诉我有关该特定Safari版本的问题是什么。
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="REPLACEME.apps.googleusercontent.com">
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
}
</script>
似乎是使用Safari首选项隐私]的Mac OS X v10.15.2的新更新,> 跟踪:防止跨站点跟踪 未选中并已通过Google客户端登录JavaScript库损坏。
尽管在Safari隐私首选项中具有已跟踪:防止跨站点跟踪
选项已选中,但在Safari专用Windows中无法使用Google登录。请参见github问题:https://github.com/google/google-api-javascript-client/issues/589
此问题似乎不仅限于google-api-js-client
库:https://www.reddit.com/r/Safari/comments/eaaanh/safari_1304_on_macos_changes_to_prevent_crosssite/