I ran into the same error, and it was also caused by a bad JWT. In my case the problem was caused by the scope property. E.g.:
{
"iss": "57246542-96fe-1a63e053-0824d011072a",
"iat": 1623085200,
"exp": 1623086400,
"aud": "appstoreconnect-v1",
"bid": "com.example.testbundleid2021",
"scope": [ "PATCH /v1/appStoreVersionLocalizations/{id}" ]
}
The scope property doesn't cause problems with GET requests, but it causes PATCH requests to fail with The request method is not valid for the resource path.
Fixed by omitting the scope property.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags: