I have downloaded the ShinyTV example to test simplified sign-in on tvOS since it is not working in my own app, and I am having the same issue there.
After assigning my team to the sample app, the bundle ID updates with my team id. I copy the bundle ID into a file entitled "apple-app-site-association" with this format:
{
"webcredentials": {
"apps": [ "{MyTeamID}.com.example.apple-samplecode.ShinyTV{MyTeamID}" ]
}
}
I upload the file to my personal site, ensuring that the content type is application/json. I adjust the Associated Domain entitlement to:
webcredentials:*.{personal-site.com}?mode=developer
using the alternate mode to force it to load from my site, not the CDN.
When I run the build on tvOS, and click the Sign In button, it fails with these errors:
Failed to start session: Error Domain=com.apple.CompanionServices.CPSErrorDomain Code=205 "Failed to prepare authorization requests" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=com.apple.CompanionServices.CPSErrorDomain Code=205 \"Missing associated web credentials domains\" UserInfo={NSLocalizedDescription=Missing associated web credentials domains}"
), NSLocalizedDescription=Failed to prepare authorization requests}
Session failed: Error Domain=com.apple.CompanionServices.CPSErrorDomain Code=205 "Failed to prepare authorization requests" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=com.apple.CompanionServices.CPSErrorDomain Code=205 \"Missing associated web credentials domains\" UserInfo={NSLocalizedDescription=Missing associated web credentials domains}"
), NSLocalizedDescription=Failed to prepare authorization requests}
ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "(null)" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=com.apple.CompanionServices.CPSErrorDomain Code=205 \"(null)\""
)}
Failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "Failed to prepare authorization requests" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=com.apple.CompanionServices.CPSErrorDomain Code=205 \"Missing associated web credentials domains\" UserInfo={NSLocalizedDescription=Missing associated web credentials domains}"
), NSLocalizedDescription=Failed to prepare authorization requests}
What am I missing here?
Nested in the error is Missing associated web credentials domains
. That indicates that CompanionServices [1], the thing that raised the com.apple.CompanionServices.CPSErrorDomain
/ 205 error, got no web credential domains for your app from the lower-level parts of the system. That lower-level system is a wrapper around the SharedWebCredential (SWC) subsystem [2]. SWC has pretty good logging, so you could look for earlier log entries from that subsystem. These typically have the com.apple.swc
subsystem in the system log.
The other thing to do here is run swcutil
to check you AASA file. TN3155 Debugging universal links talks about this, albeit in a different context.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] AFAIK this is purely an implementation detail, with no external visibility.
[2] In contrast, SharedWebCredential crops up in a bunch of places, including:
- The SecSharedCredentials API, documented in Shared Web Credentials.
- The
swc
inswcutil
, as explained in TN3155 Debugging universal links.