Update:
Just for kicks and giggles, I tried accessing the endpoints another way and wouldn’t you know it, it worked. Therefore, I presume the problem is in the curl commands with the headers. I couldn’t tell you exactly what the problem is, though. At least I now know that the tokens were not invalid.
Seeing as I the curl commands were mostly copy/paste from the documentation page, I figured the verbose log information might be worth a look just in case there’s some update that needs to be made to the docs.
Note: Unnecessary use of -X or --request, GET is already inferred.
* Expire in 0 ms for 6 (transfer 0x1e88880)
(above line more or less repeated about 66 times)
* Trying 52.38.186.166...
* TCP_NODELAY set
* Expire in 149996 ms for 3 (transfer 0x1e88880)
* Expire in 200 ms for 4 (transfer 0x1e88880)
* Connected to id.twitch.tv (52.38.186.166) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=id.twitch.tv
* start date: May 24 00:00:00 2019 GMT
* expire date: Jun 24 12:00:00 2020 GMT
* subjectAltName: host "id.twitch.tv" matched cert's "id.twitch.tv"
* issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* 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 0x1e88880)
> GET /oauth2/validate HTTP/2
> Host: id.twitch.tv
> User-Agent: curl/7.64.0
> Accept: */*
> Authorization: Bearer <valid access token>
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 401
< date: Tue, 19 May 2020 22:23:26 GMT
< content-type: application/json
< content-length: 48
< server: nginx/1.14.1
< access-control-allow-origin: *
< x-ctxlog-logid: 1-5ec45c5e-932e4b78b8cd941cd584a0d8
<
{"status":401,"message":"invalid access token"}
* Connection #0 to host id.twitch.tv left intact