cloudkitcloudkit-web-services

CloudKit Authentication Returning 404


I'm working on a web app that grabs data from an iOS app using CloudKit. As part of the application, they must login using their AppleID. However, when I try to login, I'm getting a 404. I request the following URL:

https://api.apple-cloudkit.com/1/[mycontainer]/development/users/current?ckAPIToken=[mytoken]

I get back an object that looks like this:

{
  "uuid" : "123-abc",
  "serverErrorCode" : "AUTHENTICATION_REQUIRED",
  "reason" : "request needs authorization",
  "redirectURL" : "https://idmsa.apple.com/IDMSWebAuth/auth2?oauth_token=OATTKN49471611-really-long-alpha-code"
}

However, when I redirect the user to the "redirectURL" parameter, I'm getting a blank 404 page. Inspecting the page, idmsa.apple.com loads, but when the JavaScript on the page requests signin?widgetKey={key} it gets a 404.

UPDATE: I'm not sure if this helps, but the https://idmsa.apple.com/IDMSWebAuth/auth2?oauth_token=[TOKEN] loads fine. However, that page uses JavaScript to load https://idmsa.apple.com/appleauth/auth/signin?widgetKey=[widgetkey]&locale=US-EN which is failing with a 404. However, it's only failing for me and seems to work for others.


Solution

  • Apparently this was a bug with Apple's CloudKit service. They are aware of the issue and have been working on a fix.