Getting ShinyTV Example to Work

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?

Answered by DTS Engineer in 848907022

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:

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:

Thanks for the suggestions. I have tried a few times streaming console data from my Apple TV, and the only items relevant to my password request are from the CompanionServices subsystem and AuthenticationServices. com.apple.swc does not show up for me.

Testing with swcutil all came back positive that the file can be downloaded and that it can identify the webcredentials section, the app id, and the domain.

I saw in the docs a suggestion to take a sysdiagnose but my 3rd gen doesn't support that, and tvOS shared login does not appear to work on the simulator.

Which specific Apple TV do you have?

If you’re not sure, there’s an Apple Support article that’ll help: Identify your Apple TV model.

I’m asking because Apple TV (3rd generation), the version that doesn’t support sysdiagnose logs, is really old. AFAICT we dropped support for it in tvOS 9! Which makes me think you might have an Apple TV 4K (3rd generation), which is a very different beast, and which definitely supports sysdiagnose logs.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have an Apple TV 4K (3rd generation) and was able to generate a sysdiagnose, so thanks for that clarification. This document could probably use updating because it makes no such distinction between 3rd gen devices.

Nevertheless, going through the swcutil_show.txt, ShinyTV is not listed among the SharedWebCredential apps. I have also tried with another app of mine with a different domain, both with validated AASA files using swcutil.

If the AASA is set up correctly and in the right place, and the app has Associated Domain entitlements, what else could be preventing it from appearing in the swcutil_show.txt file?

Accepted Answer

I have solved this problem. It seems that adding the Associated Domain credential inadvertently created a second entitlement file in a different location and the system was not properly resolving the entitlement. Once I deleted both entitlement files and started fresh, sign in worked properly.

Getting ShinyTV Example to Work
 
 
Q