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

通过composer安装的3.5版本无法通过身份验证 #60

Closed Geeker4py closed 6 years ago

Geeker4py commented 6 years ago

我用的laravel 通过composer安装的3.5版本无法通过身份验证 ,但 sdk 就可以,两方都是相同的配置

ghost commented 6 years ago

请提供更详细的信息

Geeker4py commented 6 years ago

use JPush\Client as JPush; use Illuminate\Support\Facades\Log;

class JPushController extends Controller { public function index() { $client = new JPush(Config::get('const.jpush.appKey'), Config::get('const.jpush.masterSecret')); $push = $client->push(); $push->setPlatform('all'); $push->addAllAudience(); $push->setNotificationAlert('中秋佳节,祝您和家人团圆美满,幸福安康!');

    try {
        $response = $push->send();
        print_r($response);
    } catch (\JPush\Exceptions\APIConnectionException $e) {
        // try something here
        print $e;
    } catch (\JPush\Exceptions\APIRequestException $e) {
        // try something here
        print $e;
    }

}

}

Geeker4py commented 6 years ago

按照 readme 里面的介绍通过 composer 来安装的v3.5版本 但是 会报 [1004]: Authen failed ,我通过 jpush-api-php-client-3.5.22 这个原生php包测试 ,同样的写法配置 就完全没有问题

ghost commented 6 years ago
$client = new JPush(Config::get('const.jpush.appKey'), Config::get('const.jpush.masterSecret'));

你先把信息填到这里里面测试一下

Geeker4py commented 6 years ago

啊 是我的错 ,变量里面有个空格 ,导致你们那边 认为是一个为识别的用户 . sorry

ghost commented 6 years ago

ok,那这个 issue 就关了哈