I'm using this code to get all apps in App Store Connect:
let jwt = ...
var request = URLRequest(url: URL(string: "https://api.appstoreconnect.apple.com/v1/apps")!)
request.setValue("Bearer \(jwt)", forHTTPHeaderField: "Authorization")
let session = URLSession(configuration: .ephemeral)
let task = session.dataTask(with: request) { data, response, error in
if let error = error {
print(error)
} else if let data = data {
print(String(data: data, encoding: .utf8))
}
}
task.resume()
But the response is an error status: 400, code: ENTITY_INVALID, title: JSON processing failed
. What entity is this error referring to? And what JSON is invalid? The JWT token seems to be fine, since when using a random value I get an error 401 NOT_AUTHORIZED
.