jpush / jpush-api-php-client

JPush's officially supported PHP client library for accessing JPush APIs. 极光推送官方支持的 PHP 版本服务器端 SDK。
https://docs.jiguang.cn
MIT License
523 stars 174 forks source link

message": "Authen failed", "code": 1004 #85

Closed huiyonghkw closed 5 years ago

huiyonghkw commented 5 years ago
➜  ~ curl --insecure -X POST -v https://api.jpush.cn/v3/push -H "Content-Type: application/json"
-u "26b69cbbd8295cb1cda6d42b:eda055bad7dfa130f26de99f"
-d  '{"platform":"all","audience":"all","notification":{"alert":"Hi,JPush!"}}'
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 1087 (#0)
* Establish HTTP proxy tunnel to api.jpush.cn:443
> CONNECT api.jpush.cn:443 HTTP/1.1
> Host: api.jpush.cn:443
> User-Agent: curl/7.54.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (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, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=CN; ST=Guangdong; L=Shenzhen; O=\U6DF1\U5733\U5E02\U548C\U8BAF\U534E\U8C37\U4FE1\U606F\U6280\U672F\U6709\U9650\U516C\U53F8; CN=*.jpush.cn
*  start date: Jan 11 02:22:02 2019 GMT
*  expire date: Jan  9 08:51:19 2021 GMT
*  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
*  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 0x7fe4b8006600)
> POST /v3/push HTTP/2
> Host: api.jpush.cn
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 401
< server: nginx
< date: Sat, 15 Jun 2019 04:02:45 GMT
< content-type: application/json
<
{"error": {"message": "Authen failed", "code": 1004}}
huiyonghkw commented 5 years ago

我在应用中获取了正确的appKey与masterSecret,但是,通过CURL测试与PHP代码测试都报错

ghost commented 5 years ago

我刚刚执行你的 curl 脚本,结果是正常的

另外不要把敏感信息(master secret)暴露到外网

huiyonghkw commented 5 years ago

@helperhaps

你是怎么做到的,我这边还是报错


100    54    0    54    0     0    200      0 --:--:-- --:--:-- --:--:--   200{"error": {"message": "Authen failed", "code": 1004}}

如果不是万不得已, 我也不会把重要信息放出来啊