按要求请求时返回http code 412
但是curl 是可以访问成功的,如下:
{"level":"debug","msg":"ComponentAccessToken: {\"url\":\"https://api.weixin.qq.com/cgi-bin/component/api_component_token\",\"header\":\"{\\\"Content-Length\\\":[\\\"221\\\"],\\\"Content-Type\\\":[\\\"application/json; encoding=utf-8\\\"]}\",\"request\":\"{\\\"component_appid\\\":\\\"xxxx\\\",\\\"component_appsecret\\\":\\\"xxx\\\",\\\"component_verify_ticket\\\":\\\"ticket@@@unXm-c_-sss\\\"}\",\"response\":\"\",\"httpCode\":412,\"executeTime\":395990250}","time":"2022-09-30T12:33:00+08:00"}
curl -ivL -H 'Content-type: application/json' -d '{"component_appid":"xxx","component_appsecret":"xxxxx","component_verify_ticket":"ticket@@@dddd"}' 'https://api.weixin.qq.com/cgi-bin/component/api_component_token'
* About to connect() to api.weixin.qq.com port 443 (#0)
* Trying 101.91.34.103...
* Connected to api.weixin.qq.com (101.91.34.103) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=mp.weixin.qq.com,O=Shenzhen Tencent Computer Systems Company Limited,L=Shenzhen,ST=Guangdong Province,C=CN
* start date: Mar 14 00:00:00 2022 GMT
* expire date: Apr 14 23:59:59 2023 GMT
* common name: mp.weixin.qq.com
* issuer: CN=DigiCert Secure Site CN CA G3,O=DigiCert Inc,C=US
> POST /cgi-bin/component/api_component_token HTTP/1.1
> User-Agent: curl/7.29.0
> Host: api.weixin.qq.com
> Accept: */*
> Content-type: application/json
> Content-Length: 221
>
* upload completely sent off: 221 out of 221 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Connection: keep-alive
Connection: keep-alive
< Content-Type: application/json; encoding=utf-8
Content-Type: application/json; encoding=utf-8
< Date: Fri, 30 Sep 2022 02:51:05 GMT
Date: Fri, 30 Sep 2022 02:51:05 GMT
< Content-Length: 204
Content-Length: 204
<
* Connectio #0 to host api.weixin.qq.com left intact
{"component_access_token":"ddd-AP6RU0CwBIwkL9xDAKE3eR1iTVwuncgIS152j-04AHkSR3moIFTcAEACZN","expires_in":7200}