Generating Tokens for API Request

Last login: Wed Jun 22 21:07:07 on ttys000

besleagaalexandru@Besleagas-iMac ~ % curl -v https://api.appstoreconnect.apple.com/v1/apps -H Authorization: Bearer JWT

*   Trying 17.56.138.14:443...

* Connected to api.appstoreconnect.apple.com (17.56.138.14) port 443 (#0)

* ALPN, offering h2

* ALPN, offering http/1.1

* successfully set certificate verify locations:

*  CAfile: /etc/ssl/cert.pem

*  CApath: none

* (304) (OUT), TLS handshake, Client hello (1):

* (304) (IN), TLS handshake, Server hello (2):

* (304) (IN), TLS handshake, Unknown (8):

* (304) (IN), TLS handshake, Certificate (11):

* (304) (IN), TLS handshake, CERT verify (15):

* (304) (IN), TLS handshake, Finished (20):

* (304) (OUT), TLS handshake, Finished (20):

* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384

* ALPN, server accepted to use h2

* Server certificate:

*  subject: businessCategory=Private Organization; jurisdictionCountryName=US; jurisdictionStateOrProvinceName=California; serialNumber=C0806592; C=US; ST=California; L=Cupertino; O=Apple Inc.; OU=management:idms.group.506364; CN=api.appstoreconnect.apple.com

*  start date: Mar 29 23:02:18 2022 GMT

*  expire date: Apr 28 23:02:17 2023 GMT

*  subjectAltName: host "api.appstoreconnect.apple.com" matched cert's "api.appstoreconnect.apple.com"

*  issuer: C=US; O=Apple Inc.; CN=Apple Public EV Server RSA CA 2 - G1

*  SSL certificate verify ok.

* Using HTTP2, server supports multiplexing

* Connection state changed (HTTP/2 confirmed)

* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0

* Using Stream ID: 1 (easy handle 0x7fdc94811c00)

> GET /v1/apps HTTP/2

> Host: api.appstoreconnect.apple.com

> user-agent: curl/7.79.1

> accept: */*

> 

* Connection state changed (MAX_CONCURRENT_STREAMS == 1024)!

< HTTP/2 401 

< server: daiquiri/3.0.0

< date: Wed, 22 Jun 2022 18:19:53 GMT

< content-type: application/json

< content-length: 350

< strict-transport-security: max-age=31536000; includeSubDomains

< x-apple-jingle-correlation-key: TZWEA7WLMROU6HAI3D3FNR6M6I

< x-daiquiri-instance: daiquiri:18493001:mr85p00it-hyhk03154801:7987:22RELEASE83:daiquiri-amp-all-shared-ext-001-mr

< 

{

	"errors": [{

		"status": "401",

		"code": "NOT_AUTHORIZED",

		"title": "Authentication credentials are missing or invalid.",

		"detail": "Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens"

	}]

* Connection #0 to host api.appstoreconnect.apple.com left intact

}* Could not resolve host: Bearer

* Closing connection 1

curl: (6) Could not resolve host: Bearer

* Could not resolve host: JWT

* Closing connection 2

curl: (6) Could not resolve host: JWT

besleagaalexandru@Besleagas-iMac ~ % 

I used the "the private key associated with the key ID you specified in the header to sign the token" and received the error specified that I don't manage to undederstand in these context.

Can you provide an example of signed token ?

Kind Regards

Generating Tokens for API Request
 
 
Q