I'm having the exact same problem. Keys are created in https://appstoreconnect.apple.com/access/integrations/api with sufficient access permissions.
To eliminate all potential misdoings on my side I used altool to generate the JWTs for API requests:
JWT=$(xcrun altool --generate-jwt --apiKey "${APP_STORE_CONNECT_KEY_IDENTIFIER}" --apiIssuer "${APP_STORE_CONNECT_ISSUER_ID}" 2>&1 | tail -1)
With the generated JSON Web Token I can successfully access endpoints such as List Apps
10:56:08 priit@marmot ~ curl -H "Authorization: Bearer ${JWT}" https://api.appstoreconnect.apple.com/v1/apps | jq '.meta'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10945 100 10945 0 0 15788 0 --:--:-- --:--:-- --:--:-- 15770
{
"paging": {
"total": 1,
"limit": 50
}
}
and List Users
10:56:35 priit@marmot ~ curl -H "Authorization: Bearer ${JWT}" https://api.appstoreconnect.apple.com/v1/users | jq '.data[] | .attributes.roles'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 973 100 973 0 0 1381 0 --:--:-- --:--:-- --:--:-- 1380
[
"ACCOUNT_HOLDER",
"ADMIN"
]
But trying to access any resource under the Provisioning group results in the error described above.
For example listing certificates:
10:56:54 priit@marmot ~ curl -H "Authorization: Bearer ${JWT}" https://api.appstoreconnect.apple.com/v1/certificates | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 414 100 414 0 0 716 0 --:--:-- --:--:-- --:--:-- 716
{
"errors": [
{
"id": "e70dd620-a680-4cd7-9856-7f430955628b",
"status": "403",
"code": "FORBIDDEN_ERROR",
"title": "This request is forbidden for security reasons",
"detail": "Unable to find a team with the given Content Provider ID 'f5dbed8a-f897-4690-a802-44a53612a306' to which you belong. Please contact Apple Developer Program Support. https://developer.apple.com/support"
}
]
}
or provisioning profiles:
10:57:06 priit@marmot ~ curl -H "Authorization: Bearer ${JWT}" https://api.appstoreconnect.apple.com/v1/profiles | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 414 100 414 0 0 696 0 --:--:-- --:--:-- --:--:-- 696
{
"errors": [
{
"id": "576b557b-480f-452a-9b91-e21f3993caea",
"status": "403",
"code": "FORBIDDEN_ERROR",
"title": "This request is forbidden for security reasons",
"detail": "Unable to find a team with the given Content Provider ID 'f5dbed8a-f897-4690-a802-44a53612a306' to which you belong. Please contact Apple Developer Program Support. https://developer.apple.com/support"
}
]
}
Of course the same error happens when attempting to create, modify or delete provisioning resources.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags: