Now this is a very annoying behavior I’ve observed with Safari on Mac and accessing a variety of SAML2 protected sites – while other browsers such as Chrome don’t appear to have that problem. The authentication process may just hang, or also fail with an uninformative cookie error.
Ultimately, what helps is this: Search Keychain for “com.apple.idms.appleid.prd” – there’s probably one certificate starting with that name and having a longer extension:
You will see other certificates depending on it. Delete that certificate, at which point the others will show up as no longer valid:
Delete those too. You don’t even need to restart your browser. Just go back to the site where the authentication was not working, and refresh the page. It should work now.