Error Occurred when requesting user token (SKErrorDomain Code=7)

Trying to get the sample project to work (Adding Content to Apple Music). I've gotten a proper developer token and I can log in and see that I'm authorized by MPMediaLibrary and SKCloudServiceController. I also have both "Add to Cloud Music Library" and "Music Catalog Playback" capabilities.


When I try to return music data by clicking on the "Recents" tab, I get the error:


"No User Token was Specified. Request Authorization using the Authorization tab." I already have authorization in that tab as noted above.


From debugging, this is the code that errors out.


if SKCloudServiceController.authorizationStatus() == .authorized {

let completionHandler: (String?, Error?) -> Void = { [weak self] (token, error) in

guard error == nil else {

print("An error occurred when requesting user token: \(error!.localizedDescription)")

return

}


error.localizedDescription is SKErrorDomain Code = 7. From my searches, this seems to be a can't connect to the cloud error? Though I can't confirm that..


Any idea why I would show SKCloudService authorized in one tab but yet it still seems to error out?


Thanks for the help,

Replies

I have also experienced the same issue and filed a bug at rdar://33586163


I did have it working for a little while during beta 3 and was able to cache the token so I could work on my app. Unfortunately the cached token has now expired and now I can't authenticate again. Definitely seems like an issue on the server side as no code change within the same beta saw me get a token and get the SKErrorDomain 7.

Only the requestUserToken call requires iOS 11. The sample app already distinguishes between this with #available(ios 11) checks.


            if #available(iOS 11.0, *) {
                cloudServiceController.requestUserToken(forDeveloperToken: developerToken, completionHandler: completionHandler)
            } else {
                cloudServiceController.requestPersonalizationToken(forClientToken: developerToken, withCompletionHandler: completionHandler)
            }


Looking at the source code, I haven't figured out exactly what new APIs have been added for iOS 11 (that didn't already exist for iOS 10).

Same issue...

Running sample code and not getting the user token :/

Same issue. Not sure if this makes a difference for the priority this gets.

What's going on here. Same issue too.


Can we can an Apple response?

Is there a work around?

We are aware of the issue, and are testing a fix.

Thanks for the update 3ZS - appreciated.

Update - just to confirm, this is seemingly fixed now. I am receiving a usertoken in my test app on iOS 10.3 AND iOS 11.

Update - It's OK for me now too, I'm able to get a usertoken.

I'm getting this same problem. Still having issues?

Over a week and I can't get any progress on working on an AppleMusic integration because of this error. This is with both the example app and my own app. This is with a developer token that was previous working in both the example app and my own app. It stopped working, giving me: "An error occurred when requesting user token: The operation couldn’t be completed. (SKErrorDomain error 7.)"


Is there any reason a developer token that worked a week ago would no longer work? Is this error definitely on Apple's end. Is it getting fixed. I'm very frustrated. :-(

Have exactly the same issue, recently updated my iPad to iOS 11 beta 10. Bit late to the party but looks like the fix isn't working for me.

Ok, got past that error. I had actually created a developer token that expired, so that was my bad.


However, now I'm getting the following after doing the 'Request' flow in the example app:



2017-09-14 09:57:44.233673-0400 Adding-Content-to-Apple-Music[302:15257] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""

2017-09-14 09:57:44.234246-0400 Adding-Content-to-Apple-Music[302:15256] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"

I can search for songs, but clicking Play on them does nothing. Getting the same Code=9 error in my own app (with the same 'song won't play' behaviour).

Not working for me anymore either.. I'm using the new default code from the start of September but nothing will get me past error code 7.

Still having the same issue. Currently working on 10.3 and getting "The operation couldn’t be completed. (SKErrorDomain error 7.)". 😟 help me out