EasyWeChat📦 一个 PHP 微信 SDK

Overview

EasyWeChat

📦 一个 PHP 微信开发 SDK。

Test Status Lint Status Latest Stable Version Latest Unstable Version Total Downloads License huntr

📣 公告

为了更好的推进项目发展,保障项目更新迭代速度,EasyWeChat 正式并入微擎旗下,加上微擎团队的助力,将会为大家提供更强大更稳固更多元化的开源项目。

  • 微擎与 EasyWeChat 结合,基于微擎技术资源方面的优势,将积极发展 EasyWeChat 的开源社区,将为 EasyWeChat 开源项目注入巨大活力。
  • EasyWeChat 原作者 overtrue 将继续担任开源项目的核心开发者,继续参与项目的发展规划,共同打造更强大的开源生态社区。
  • 项目从 6.0 版本开始将修改包名为 w7corp/easywechat,5.x 及以下版本不受影响。

🚨 注意:请 PR 时往 5.x 提交,感谢您的贡献!

Requirement

  1. PHP >= 7.4
  2. Composer
  3. openssl 拓展
  4. fileinfo 拓展(素材管理模块需要用到)

Installation

$ composer require "overtrue/wechat:^5.0" -vvv

Usage

基本使用(以服务端为例):

nickname} 您好!欢迎关注 overtrue!"; }); $server->serve()->send();">


use EasyWeChat\Factory;

$options = [
    'app_id'    => 'wx3cf0f39249eb0exxx',
    'secret'    => 'f1c242f4f28f735d4687abb469072xxx',
    'token'     => 'easywechat',
    'log' => [
        'level' => 'debug',
        'file'  => '/tmp/easywechat.log',
    ],
    // ...
];

$app = Factory::officialAccount($options);

$server = $app->server;
$user = $app->user;

$server->push(function($message) use ($user) {
    $fromUser = $user->get($message['FromUserName']);

    return "{$fromUser->nickname} 您好!欢迎关注 overtrue!";
});

$server->serve()->send();

更多请参考 https://www.easywechat.com/

Documentation

官网 · 教程 · 讨论 · 微信公众平台 · WeChat Official

Integration

Laravel 5 拓展包: overtrue/laravel-wechat

Contributors

This project exists thanks to all the people who contribute. [Contribute].

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

License

MIT

FOSSA Status

Issues
  • 小程序解密The given payload is invalid.

    小程序解密The given payload is invalid.

    我用的环境

    PHP 版本:7.1.7 overtrue/wechat 版本:4.0 是否使用了框架?框架名称:

    问题及现象

    微信小程序,解密,偶尔抛出The given payload is invalid.的异常,查看了easywechat的源码,排查后发现时解密出的结果为空字符串,所以抛出异常,这是什么情况? image

    描述你的问题现象,报错贴截图粘贴或者贴具体信息,提供必要的代码段

    如果你不提供相关的代码,我不会做任何应答,直接 close,感谢!

    opened by woann 35
  • 网页授权回调中获取用户信息报错,代码40001

    网页授权回调中获取用户信息报错,代码40001

    我用的环境

    PHP 版本:PHP 7.1.15 overtrue/wechat 版本:3.3.25 是否使用了框架?框架名称 thinkPHP 5.0

    问题及现象

    这个问题我自己测试的过程中从未遇到过,是上线了以后,看到可疑的error_log我才有所注意,但至今我也未能成功复现问题(但问题每天都会出现几次,从error_log里可知)。

    我的代码跟文档里的DEMO是差不多的,但为了代码复用起见,有所整理(下面会说明):

    // 在controller里接受网页授权callback
    public function oauth_callback() {
                $serviceConfig = \config('wechat.GONG_ZHONG_HAO'); // 读取easywechat所需配置
                $service = new Wechat($serviceConfig); // 这个Wechat是我自己整理的类,算是“适配器”吧,实例化Wechat后就会在其中实例化 EasyWeChat\Foundation\Application
                $userInfo = $service->getOauthUserInfo(); // 读取已授权用户的信息
    }
    
        // 在适配器Wechat类中
        public function getOauthUserInfo() {
            $oauth = $this->app->oauth;
            $user = $oauth->user();
            $data = $user->toArray();
            try { // 这个try/catch是我发现服务器错误日志后加的
                $userInfo = [
                    'app_id' => $this->options['public_app_id'],
                    'openid' => $data['original']['openid'],
                    'nickname' => $data['original']['nickname'],
                    'sex' => $data['original']['sex'],
                    'city' => $data['original']['city'],
                    'province' => $data['original']['province'],
                    'country' => $data['original']['country'],
                    'headimgurl' => $data['original']['headimgurl'],
                ];
                return $userInfo;
            } catch (\Exception $e) {
                $errorMsg = 'app\common\service\Wechat @getOauthUserInfo:' . $e->getMessage() . "\n"
                            . '$user:' . \var_export($user, true) . "\n";
                Log::write($errorMsg, 'error');
                throw $e;
            }
        }
    
    // 上面try/catch打印出来的 $this->app->oauth->user 大概是这样的:
        array(
            'attributes' =>
                array (
                    'id' => NULL,
                    'name' => NULL,
                    'nickname' => NULL,
                    'avatar' => NULL,
                    'email' => NULL,
                    'original' =>
                        array (
                        'errcode' => 40001,
                        'errmsg' => 'invalid credential, access_token is invalid or not latest, hints: [ req_id: qR7j6a0664s153 ]',
                        ),
                    'token' => Overtrue\Socialite\AccessToken::__set_state(array(
                        'attributes' => array (
                                'access_token' => '。。。。。。', // 隐去敏感信息
                                'expires_in' => 7200,
                                'refresh_token' => '。。。。。。',// 隐去敏感信息
                                'openid' => '。。。。。',// 隐去敏感信息
                                'scope' => 'snsapi_userinfo',
                            ),
                    )),
                    'provider' => 'WeChat',
                ),
            )
    

    我试着根据这里的openid来查easywechat本身的log,发现: 1、上面try/catch中的log是2018-04-08T08:01:04+08:00;需要说明一下,只要报了这个错,我的应用就完全无法使用了。 2、easywechat的日志里,发现了成功发送模板消息的日志,时间是2018-04-08 08:01:50,与上述log仅差不到1分钟;成功发送模板消息,表示用户正常访问并且成功实现了操作。 3、综上两点,用户很可能是第一次打开应用发现页面报错打不开;接着马上关掉,然后马上重开应用,此时应用就能正常访问了。

    从上面报错提示看是access_token失效了?但access_token不是由easywechat管理的么?我都不知道怎么往下查了,求指条明路。

    opened by Array-Huang 31
  • 请问 Symfony\Component\Cache\Simple\FilesystemCache 这个类找不到怎么办

    请问 Symfony\Component\Cache\Simple\FilesystemCache 这个类找不到怎么办

    如题,使用php7.0+laravel5.1的开发环境,wechat版本为4.0,服务器可以收到请求并回复,但尝试服务器主动向关注者发消息时报了这个错,google查找无果,大都要求安装symfony/finder这个包,安装后仍然没有效果,在laravel的vender目录下查找也没有发现symfony\component这个包,请问应该怎么解决?

    opened by malphitee 31
  • 微信支付下单错误

    微信支付下单错误

    我用的环境

    PHP 版本:php5.6 overtrue/wechat 版本:3.0

    问题及现象

    $options = [
        'debug'  => true,
        'app_id'  => '',         // AppID
        'secret'  => '',     // AppSecret
        'oauth' => [
            'scopes'   => ['snsapi_userinfo'],
            'callback' => '',
        ],
        // payment
        'payment' => [
            'merchant_id'        => '',
            'key'                => '',
            'cert_path'          => '', // XXX: 绝对路径!!!!
            'key_path'           => '',      // XXX: 绝对路径!!!!
            'notify_url'         => '',
            'device_info'        => 'WEB',
        ],
        'log' => [
            'level' => 'debug',
            'file'  => '/tmp/easywechat.log', // XXX: 绝对路径!!!!
        ],
    ];
    
    return new Application($options);
    
    
    $attributes = [
            'body'             => $detail,
            'out_trade_no'     => date('YmdHis') . rand(1000, 9999),
            'total_fee'        => $fee,
            'trade_type'       => 'JSAPI',
        ];
    
        $order = new Order($attributes);
    
        $res = $payment->prepare($order);
    
    一直提示签名错误
    
    opened by pavlelee 28
  • easywechat4.0 [ error ] [-1]Authorize Failed: {

    easywechat4.0 [ error ] [-1]Authorize Failed: {"errcode":41008,"errmsg":"missing code, hints: [ req_id: jCbezQaLRa-yh_Wxa ]"}

    我用的环境

    • PHP 版本:PHP 7
    • overtrue/wechat 版本:4.0
    • 是否使用了框架?框架名称:thinkphp5

    问题及现象

    //授权跳转 public function get_openid(){

    //跳转获取openid
    $app = Factory::officialAccount($this->config_wechat);
    $oauth = $app->oauth;
    if (empty(Cookie::get('wechat_user'))) {
    
    	Cookie::set('target_url', $this->request->url());
    
    	// return $oauth->redirect();
    	// 这里不一定是return,如果你的框架action不是返回内容的话你就得使用
    	$oauth->redirect()->send();
    }
    

    }

    //跳转获取openid public function oauth_callback(){

    $app = Factory::officialAccount($this->config_wechat);
    $oauth = $app->oauth;
    
    // 获取 OAuth 授权结果用户信息
    $user = $oauth->user();
    
    // 永久保存Cookie
    Cookie::forever('wechat_user',$user->toArray());
    
    $targetUrl = empty(Cookie::get('target_url')) ? '/' : Cookie::get('target_url');
    
    header('location:'. $targetUrl);
    

    }

    偶尔会出现这个问题,测试很多次都是好的,但错误日志里每天都十多条关于这个的错误信息

    域名了备了案,也在公众号设置了域名白名单

    [ error ] [-1]Authorize Failed: {"errcode":41008,"errmsg":"missing code, hints: [ req_id: jCbezQaLRa-yh_Wxa ]"}

    https://yike.io/ 另外一刻社区上无法提交问题,报错信息:This action is unauthorized.

    opened by kl521516 27
  • 微信公众号不能回复接收到的消息,日志无报错

    微信公众号不能回复接收到的消息,日志无报错

    我用的环境

    PHP 版本:5.6 overtrue/wechat 版本:3.1.8

    问题及现象

    服务器已经配置成功,用户发送消息可以接收,日志有提示记录没有报错,问题是用户接收不了消息,微信会提示公众号当前无法提供服务 描述你的问题现象,报错贴截图粘贴或者贴具体信息,提供必要的代码段 Uploading TIM截图20170406130359.png… `namespace App\Http\Controllers\service;

    use Log; use App\Http\Controllers\Controller;

    class WechatController extends Controller {

    /**
     * 处理微信的请求消息
     *
     * @return string
     */
    public function serve()
    {
        Log::info('request arrived.'); # 注意:Log 为 Laravel 组件,所以它记的日志去 Laravel 日志看,而不是 EasyWeChat 日志
    		
        $wechat = app('wechat');
        $wechat->server->setMessageHandler(function($message){
            return "欢迎关注 overtrue!";
        });
    
        Log::info('return response.');
    
        return $wechat->server->serve();
    }
    

    }`

    opened by dm22933 24
  • getMessage获取到的数据有误

    getMessage获取到的数据有误

    我用的环境

    PHP 版本:7.2 overtrue/wechat 版本:4.0 是否使用了框架?框架名称:laravel

    问题及现象

    我这边直接按照demo来, 接收到客服请求直接push一个消息, 就这么简单 现象: 小程序端 没有收到信息 代码截图:

    image

    image

    然后我debug了半天, 最终发现的可能原因就是$app->server->getMessage()方法获取到的并不是传参的数组, 而是一个数组key是0, value是get方式的传参字符串, 这样导致后面很多地方以getMessage获取当数组用的地方取出来的数据都是空的截图:

    image

    不知道这是什么原因, 是哪里需要配置? 请教下

    opened by ohmygd 22
  • 网页能授权但无法获取用户信息,代码跟官方文档一样。

    网页能授权但无法获取用户信息,代码跟官方文档一样。

    我用的环境

    PHP 版本:5.6 overtrue/wechat 版本:3.3

    问题及现象

    按照官方文档设置在最后一步获取用户信息中会返回curl信息,复制到浏览器中打开能够获取用户信息。 测试地址:http//meiwu.xxxxx.com/wx/user 描述你的问题现象,报错贴截图粘贴或者贴具体信息,提供必要的代码段 qq 20170524233152

    opened by dm22933 22
  • 使用officialAccount获取用户access_token时,origin中没有refresh_token、expires_in信息

    使用officialAccount获取用户access_token时,origin中没有refresh_token、expires_in信息

    使用officialAccount获取用户access_token时,origin中没有refresh_token、expires_in信息

    按理说origin中应该包含微信接口返回的所有的信息呀

    image

    opened by luxin88 22
  • 企业微信管理多个应用,出现access_token不能使用的BUG

    企业微信管理多个应用,出现access_token不能使用的BUG

    我用的环境

    PHP 版本:7 overtrue/wechat 版本:4.0 是否使用了框架?框架名称:tp3.2

    问题及现象

    描述你的问题现象,报错贴截图粘贴或者贴具体信息,提供必要的代码段 $config = [ 'corp_id' => 'xxxxx', // 应用列表 'agents' => [ 'ceshi2' => [ 'agent_id' => '1000011', 'secret' => 'xxxxxxxxxxxxxxx' ], 'ceshi' => [ 'agent_id' => '1000010', 'secret' => 'xxxxxxxxxxxxxxx' ] ], 'response_type' => 'array', 'log' => [ 'level' => 'debug', 'file' => DIR . '/wechat.log', ], ]; $work = Factory::work($config); $agents1 = $work->agent->get('1000011'); // 能正常使用 $agents0 = $work->agent->get('1000010'); // 提示accesstoken不能使用在本应用

    如果你不提供相关的代码,我不会做任何应答,直接 close,感谢!

    Bug 
    opened by pi-ka-qiu 21
  • 弱弱问一下5.x支持php8.1吗

    弱弱问一下5.x支持php8.1吗

    我用的环境

    • PHP 版本:
    • overtrue/wechat 版本:
    • 是否使用了框架?框架名称:

    问题及现象

    opened by weiconto 0
  • 6.0版本 替换guzz客户端疑问?

    6.0版本 替换guzz客户端疑问?

    我用的环境

    • PHP 版本:8.0.12
    • overtrue/wechat 版本:6.0-beta10
    • 是否使用了框架?框架名称:hyperf
    • 环境 swoole 4.8.1

    问题及现象

    • 因为6.0没有使用guzz, 无法setHttpClient
    • 直接运行
            $config = [
                'app_id' => 'wx3cf0f39249eb0exx',
                'secret' => 'f1c242f4f28f735d4687abb469072axx',
                'token' => 'easywechat',
                'aes_key' => '' // 明文模式请勿填写 EncodingAESKey
                //...
            ];
    
            $app = new Application($config);
            $app->getAccessToken()->getToken();
    

    默认会使用 Symfony\Component\HttpClient\CurlHttpClient

    报错信息

    TypeError: Symfony\Component\HttpClient\Response\CurlResponse::__construct(): Argument #2 ($ch) must be of type CurlHandle|string, Swoole\Coroutine\Curl\Handle given, called in /Users/t/WWW/php-service/vendor/symfony/http-client/CurlHttpClient.php on line 295(0) in /Users/t/WWW/php-service/vendor/symfony/http-client/Response/CurlResponse.php:46
    Stack trace:
    #0 /Users/t/WWW/php-service/vendor/symfony/http-client/CurlHttpClient.php(295): Symfony\Component\HttpClient\Response\CurlResponse->__construct(Object(Symfony\Component\HttpClient\Internal\CurlClientState), Object(Swoole\Coroutine\Curl\Handle), Array, NULL, 'GET', Object(Closure), 478977)
    #1 /Users/t/WWW/php-service/vendor/overtrue/wechat/src/OfficialAccount/AccessToken.php(66): Symfony\Component\HttpClient\CurlHttpClient->request('GET', 'https://api.wei...', Array)
    #2 /Users/t/WWW/php-service/runtime/container/proxy/App_Controller_WeChatController.proxy.php(55): EasyWeChat\OfficialAccount\AccessToken->getToken()
    
    • \EasyWeChat\Kernel\Traits\InteractWithHttpClient::setHttpClient 是否可以兼容 Psr\Http\Client\ClientInterface
    opened by tw2066 0
  • 官网备案中,暂时无法访问

    官网备案中,暂时无法访问

    官网域名备案中,暂停解析,临时域名

    https://easywechat.vercel.app

    opened by overtrue 3
  • 官网无法访问啊???

    官网无法访问啊???

    我用的环境

    • PHP 版本:
    • overtrue/wechat 版本:
    • 是否使用了框架?框架名称:

    问题及现象

    opened by garenlyu 5
  • 文档访问不了了

    文档访问不了了

    文档访问不了了

    opened by yexueduxing 1
  • 4.x版本,微信支付服务商模式 支付时报支付签名错误

    4.x版本,微信支付服务商模式 支付时报支付签名错误

    我用的环境

    • PHP 版本:php7.2
    • overtrue/wechat 版本:4.x
    • 是否使用了框架?框架名称:thinkphp6

    问题及现象

    • 问题:
    • 微信支付服务商模式,配置完信息,调起微信支付时报:支付签名错误

    • 下段代码 是官网文档4.x版本里的
    #服务商
    #设置子商户信息
    $app->setSubMerchant('sub-merchant-id', 'sub-app-id');  // 子商户 AppID 为可选项
    
    • 问题解决 :在调用上段代码的时候,传入 sub-app-id 的参数,最终成功调起微信支付
    #微信支付返回数据示例
    $data = [
        'appId'=>'wx1111111111111',
        'timeStamp'=>16565656656,
        'nonceStr'=>'56s3askwkas52',
        'package'=>'prepay_id=wx12123456789123456789',
        'signType'=>'MD5',
        'paySign'=>'83FA70514464646CD701AFFCCC94D2'
    ];
    
    • 通过日志记录查看

    原因:在未传入子商户AppID时 $data['appId']返回的是服务商关联的AppID,当传入子商户AppID时 $data['appId']返回的才是子商户AppID

    opened by fly-xiang-123 0
  • 请教下那个版本支持微信支付3.0和会员卡2.0呀

    请教下那个版本支持微信支付3.0和会员卡2.0呀

    我用的环境

    • PHP 版本:
    • overtrue/wechat 版本:
    • 是否使用了框架?框架名称: thinkphp

    问题及现象

    请教下那个版本支持微信支付3.0和会员卡2.0呀?

    opened by Funny-dot 1
  • 修改了base_uri后授权使用了全地址,授权地方的前缀还是没被改过来

    修改了base_uri后授权使用了全地址,授权地方的前缀还是没被改过来

    我用的环境

    • PHP 版本:7.3
    • overtrue/wechat 版本:4.4.0
    • 是否使用了框架?框架名称:laravel 5.7

    代码

    $app = Factory::officialAccount([
                'app_id' => '',
                'secret' => '',
                'token' => '',
                'http' => [
                 // http://docs.guzzlephp.org/en/stable/request-options.html
                    'verify'=>false,
                     'base_uri' => 'https://xxxxxx/', // 更改的地址
                ],
            ]);
            print_r($app->template_message->send([
                'touser' => '',
                'template_id' => '',
                'url' => '',
                'data' => [
                    'first' => '测试',
                    'keyword1' => date('Y-m-d H:i:s'),  //交易时间
                    'keyword2' => '待使用',  //交易类型
                    'keyword3' => '测试',  //交易内容
                    'remark' => '感谢您的使用,轻点查看详情',  //备注信息
                ],
            ]));
    

    我在更改了base_uri这个后虽然是起效果了,但是在授权AccessToken那里报错了,主要是因为AccessToken前缀地址没有跟着我的前缀更改,更改后的调试输出的地址是“https://api.weixin.qq.com/cgi-bin/token”,所以前缀的地址还是没有更改回来

    1) ExampleTest::testExample
    EasyWeChat\Kernel\Exceptions\HttpException: Request access_token fail: {"errcode":40164,"errmsg":"invalid ip x.x.x.x ipv6 ::ffff:x.x.x.x, not in whitelist rid: 61ad8cbd-7d2267b7-01e33671"}
    
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/AccessToken.php:165
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/AccessToken.php:107
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/AccessToken.php:221
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/AccessToken.php:182
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/BaseClient.php:193
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php:67
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:64
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/Middleware.php:31
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:71
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/Middleware.php:63
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/HandlerStack.php:75
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/Client.php:331
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/Client.php:168
    /www/queue/weixin.api.bei-lin.cn/vendor/guzzlehttp/guzzle/src/Client.php:187
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/Traits/HasHttpRequests.php:145
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/BaseClient.php:152
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/Kernel/BaseClient.php:94
    /www/queue/weixin.api.bei-lin.cn/vendor/overtrue/wechat/src/OfficialAccount/TemplateMessage/Client.php:143
    /www/queue/weixin.api.bei-lin.cn/tests/ExampleTest.php:42
    

    通过后面的调试发现只要修改“overtrue/wechat/src/OfficialAccount/Auth/AccessToken.php”文件下的内容,只要把前缀删除即可 修改前

    <?php
    
    /*
     * This file is part of the overtrue/wechat.
     *
     * (c) overtrue <[email protected]>
     *
     * This source file is subject to the MIT license that is bundled
     * with this source code in the file LICENSE.
     */
    
    namespace EasyWeChat\OfficialAccount\Auth;
    
    use EasyWeChat\Kernel\AccessToken as BaseAccessToken;
    
    /**
     * Class AuthorizerAccessToken.
     *
     * @author overtrue <[email protected]>
     */
    class AccessToken extends BaseAccessToken
    {
        /**
         * @var string
         */
        protected $endpointToGetToken = 'https://api.weixin.qq.com/cgi-bin/token';
    
        protected function getCredentials(): array
        {
            return [
                'grant_type' => 'client_credential',
                'appid' => $this->app['config']['app_id'],
                'secret' => $this->app['config']['secret'],
            ];
        }
    }
    
    

    修改后

    <?php
    
    /*
     * This file is part of the overtrue/wechat.
     *
     * (c) overtrue <[email protected]>
     *
     * This source file is subject to the MIT license that is bundled
     * with this source code in the file LICENSE.
     */
    
    namespace EasyWeChat\OfficialAccount\Auth;
    
    use EasyWeChat\Kernel\AccessToken as BaseAccessToken;
    
    /**
     * Class AuthorizerAccessToken.
     *
     * @author overtrue <[email protected]>
     */
    class AccessToken extends BaseAccessToken
    {
        /**
         * @var string
         */
        protected $endpointToGetToken = 'cgi-bin/token';   //只需要把这条前缀代码删除即可
    
        protected function getCredentials(): array
        {
            return [
                'grant_type' => 'client_credential',
                'appid' => $this->app['config']['app_id'],
                'secret' => $this->app['config']['secret'],
            ];
        }
    }
    
    

    希望作者可以尽快修复,以及小程序那里的文件也一样“overtrue/wechat/src/OfficialAccount/Auth/AccessToken.php”、“overtrue/wechat/src/MiniProgram/Auth/AccessToken.php”主要是这两个文件

    opened by 1106245966 4
  • 微信网页授权 state 参数被修改导致授权失败

    微信网页授权 state 参数被修改导致授权失败

    我用的环境

    • PHP 版本:7.4.8
    • overtrue/wechat 版本:5.9.0
    • 是否使用了框架?框架名称:Hyperf 2.1

    问题及现象

    目前发现部分授权请求会失败,查看日志发现错误信息如下:

    [2021-12-03 08:51:06] wechat.ERROR: wechat login error: Authorize Failed: {"errcode":40029,"errmsg":"invalid code, rid: 61a969fa-3824f418-2a65b14e"} {"code":"071nck1w3wWMcX2Ogg3w3KUxTT3nck1p","state":"8e565e2c99bd05b57915db1339430b71https://i.maxthon.cn","type":"wechat"} []
    

    可以看到state参数被添加了傲游浏览器的官网地址,这个应该是有用户使用遨游浏览器,在微信回调回来的时候,state参数被浏览器给修改了,这应该就是明显的 CSRF 攻击,除了不用这个浏览器之外,有其他解决方案吗

    opened by mogody 1
Releases(5.15.0)
  • 5.15.0(Jan 11, 2022)

    What's Changed

    • 新增企业微信接口 by @bangbangda in https://github.com/w7corp/easywechat/pull/2335
    • 修改客户朋友圈测试bug by @bangbangda in https://github.com/w7corp/easywechat/pull/2339

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.14.1...5.15.0

    Source code(tar.gz)
    Source code(zip)
  • 6.0-beta11(Jan 9, 2022)

  • 5.14.1(Jan 6, 2022)

    What's Changed

    • fix tests by @aa24615 in https://github.com/w7corp/easywechat/pull/2325
    • fix style by @aa24615 in https://github.com/w7corp/easywechat/pull/2326
    • 优化base_uri by @qiqizjl in https://github.com/w7corp/easywechat/pull/2329
    • 企业微信通知模块优化 by @ranpro in https://github.com/w7corp/easywechat/pull/2332
    • 调整内容安全 API 兼容性 by @ranpro in https://github.com/w7corp/easywechat/pull/2333

    New Contributors

    • @ranpro made their first contribution in https://github.com/w7corp/easywechat/pull/2332

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.14.0...5.14.1

    Source code(tar.gz)
    Source code(zip)
  • 5.14.0(Dec 31, 2021)

    What's Changed

    • Add group welcome template by @bangbangda in https://github.com/w7corp/easywechat/pull/2316
    • 解决Laravel 安装的依赖冲突 by @mofengme in https://github.com/w7corp/easywechat/pull/2318
    • Update ServiceProvider.php (#2086) by @overtrue in https://github.com/w7corp/easywechat/pull/2319
    • 增加 客户群opengid转换接口 by @bangbangda in https://github.com/w7corp/easywechat/pull/2324

    New Contributors

    • @mofengme made their first contribution in https://github.com/w7corp/easywechat/pull/2318

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.13.0...5.14.0

    Source code(tar.gz)
    Source code(zip)
  • 6.0-beta10(Dec 30, 2021)

    What's Changed

    • [desc] miniapp short_link url_link by @aa24615 in https://github.com/w7corp/easywechat/pull/2300
    • [docs] miniapp 获取手机号 by @aa24615 in https://github.com/w7corp/easywechat/pull/2304
    • [docs] pay 增加回调通知文档;[docs] common 修复$oauth示例问题 by @jiangslee in https://github.com/w7corp/easywechat/pull/2315
    • [fixed] open_platform 补充默认处理VerifyTicket推送事件 by @jiangslee in https://github.com/w7corp/easywechat/pull/2320
    • [fixed] open_platform 修复getAuthorization、refreshAuthorizerToken by @jiangslee in https://github.com/w7corp/easywechat/pull/2321
    • 修复签名时传入参数错误 by @fncong in https://github.com/w7corp/easywechat/pull/2322
    • V2版本签名修复 by @fncong in https://github.com/w7corp/easywechat/pull/2323

    Full Changelog: https://github.com/w7corp/easywechat/compare/6.0-beta9..6.0-beta10

    Source code(tar.gz)
    Source code(zip)
  • 4.5.0(Dec 27, 2021)

    What's Changed

    • 4.x 日常使用维护 by @this-BaiShi in https://github.com/w7corp/easywechat/pull/2277
    • 优化BaseUri by @aa24615 in https://github.com/w7corp/easywechat/pull/2291

    Full Changelog: https://github.com/w7corp/easywechat/compare/4.4.3...4.5.0

    Source code(tar.gz)
    Source code(zip)
  • 5.13.0(Dec 27, 2021)

  • 5.12.0(Dec 21, 2021)

    What's Changed

    • 草稿箱,发布能力 by @elim051 in https://github.com/w7corp/easywechat/pull/2307

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.11.0...5.12.0

    Source code(tar.gz)
    Source code(zip)
  • 5.11.0(Dec 18, 2021)

    What's Changed

    • [feature] miniapp short link by @aa24615 in https://github.com/w7corp/easywechat/pull/2299
    • [feature] miniapp 获取手机号 by @aa24615 in https://github.com/w7corp/easywechat/pull/2303

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.10.3...5.11.0

    Source code(tar.gz)
    Source code(zip)
  • 5.10.3(Dec 14, 2021)

    What's Changed

    • 优化BaseUri by @aa24615 in https://github.com/w7corp/easywechat/pull/2292
    • 新增 企业微信获取企业已配置的「联系我」列表 by @yxlix in https://github.com/w7corp/easywechat/pull/2295
    • 修复获取待分配的离职成员列表传值问题 by @canren in https://github.com/w7corp/easywechat/pull/2297

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.10.2...5.10.3

    Source code(tar.gz)
    Source code(zip)
  • 3.6.1(Dec 14, 2021)

    What's Changed

    • 3.x by @jackwangshukai in https://github.com/w7corp/easywechat/pull/2288

    New Contributors

    • @jackwangshukai made their first contribution in https://github.com/w7corp/easywechat/pull/2288

    Full Changelog: https://github.com/w7corp/easywechat/compare/3.4.0...3.6.1

    Source code(tar.gz)
    Source code(zip)
  • 6.0-beta9(Dec 10, 2021)

    What's Changed

    • [work] 新增可选参数agent_id by @aa24615 in https://github.com/w7corp/easywechat/pull/2275
    • [feature] [wokr] 新增Utils jssdk by @aa24615 in https://github.com/w7corp/easywechat/pull/2281
    • [docs] [work] 工具 && 企业微信ID转换 by @aa24615 in https://github.com/w7corp/easywechat/pull/2290

    Full Changelog: https://github.com/w7corp/easywechat/compare/6.0-beta8...6.0-beta9

    Source code(tar.gz)
    Source code(zip)
  • 5.10.2(Dec 7, 2021)

    What's Changed

    • 企业微信 增加 将自建应用获取的corpid转换为第三方应用获取的corpid,将自建应用获取的userid转换为第三方应用获取的userid 接口 by @canren in https://github.com/w7corp/easywechat/pull/2279
    • [feature] 企业微信ID升级 客户id转换 by @aa24615 in https://github.com/w7corp/easywechat/pull/2283
    • 企业微信服务商应用推送ticket响应问题修复 by @houguang in https://github.com/w7corp/easywechat/pull/2282

    New Contributors

    • @houguang made their first contribution in https://github.com/w7corp/easywechat/pull/2282

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.10.1...5.10.2

    Source code(tar.gz)
    Source code(zip)
  • 3.5.0(Dec 6, 2021)

    What's Changed

    • 3.x by @jackwangshukai in https://github.com/w7corp/easywechat/pull/2288

    New Contributors

    • @jackwangshukai made their first contribution in https://github.com/w7corp/easywechat/pull/2288

    Full Changelog: https://github.com/w7corp/easywechat/compare/3.4.0...3.5.0

    Source code(tar.gz)
    Source code(zip)
  • 5.10.1(Nov 23, 2021)

    What's Changed

    • JSSDK 增加生成小程序红包配置信息 by @bangbangda in https://github.com/w7corp/easywechat/pull/2270

    Full Changelog: https://github.com/w7corp/easywechat/compare/5.9.1...5.10.1

    Source code(tar.gz)
    Source code(zip)
  • 4.4.3(Nov 19, 2021)

    What's Changed

    • feature getGroupChat add need_name param by @woke123 in https://github.com/w7corp/easywechat/pull/2220
    • 对保存的ticket进行suiteId验证,避免项目在单个三方应用下,因为多个三方应用填写三方应用回调链接错误的情况下导致的ticket互刷问题 by @this-BaiShi in https://github.com/w7corp/easywechat/pull/2269

    New Contributors

    • @woke123 made their first contribution in https://github.com/w7corp/easywechat/pull/2220
    • @this-BaiShi made their first contribution in https://github.com/w7corp/easywechat/pull/2269

    Full Changelog: https://github.com/w7corp/easywechat/compare/4.4.2...4.4.3

    Source code(tar.gz)
    Source code(zip)
  • 6.0-beta8(Nov 18, 2021)

  • 6.0-beta7(Nov 16, 2021)

  • 6.0-beta6(Nov 16, 2021)

  • 6.0-beta5(Oct 24, 2021)

Zoho CRM API SDK is a wrapper to Zoho CRM APIs. By using this sdk, user can build the application with ease

Archival Notice: This SDK is archived. You can continue to use it, but no new features or support requests will be accepted. For the new version, refe

null 79 Dec 30, 2021
The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructure and leverage the power of 1Password Secrets Automation

1Password Connect PHP SDK The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructu

Michelangelo van Dam 8 Sep 16, 2021
Unofficial Firebase Admin SDK for PHP

Firebase Admin PHP SDK Table of Contents Overview Installation Documentation Support License Overview Firebase provides the tools and infrastructure y

kreait 1.7k Jan 20, 2022
Notion PHP SDK

Notion PHP SDK This is an unofficial PHP SDK for the new public Notion API. It's work in progress as we didn't get the change to be included to the pr

Codecycler 22 Jan 4, 2022
爱发电非官方简易 PHP SDK

afdian-php-sdk 爱发电非官方简易 PHP SDK by Akkariin 这是一个简单的 SDK,可以用于查询爱发电的订单和赞助者信息 Installation 将项目 clone 到本地即可 git clone https://github.com/ZeroDream-CN/afdi

ZeroDream-CN 10 Jan 12, 2022
AWS Cognito package using the AWS SDK for PHP/Laravel

Laravel Package to manage Web and API authentication with AWS Cognito AWS Cognito package using the AWS SDK for PHP This package provides a simple way

EllaiSys 33 Jan 20, 2022
PHP SDK to interact with the Casper Network nodes via RPC

casper-php-sdk PHP SDK to interact with Casper Network nodes via RPC Install composer require make-software/casper-php-sdk Examples RPC Client: $node

MAKE Technology LLC 6 Dec 21, 2021
A Laravel 5+ (and 4) service provider for the AWS SDK for PHP

AWS Service Provider for Laravel 5/6/7/8 This is a simple Laravel service provider for making it easy to include the official AWS SDK for PHP in your

Amazon Web Services 1.4k Jan 14, 2022
A complete Notion SDK for PHP developers.

notion-sdk-php A complete Notion SDK for PHP developers. Installation composer require mariosimao/notion-php Getting started A Notion token will be n

Mario Simão 39 Jan 11, 2022
SDK of the LINE Login API for PHP

LINE Login for PHP SDK of the LINE Login API for PHP Documentation See the official API documentation for more information. Installation Use the packa

null 2 Nov 3, 2021
PHP SDK - Flexie CRM fiskalizimi solution

PHP SDK - Flexie CRM fiskalizimi solution Fiskalizimi PHP SDK allows you to talk and generate your e-invoices programmatically from your own solution

Flexie CRM 3 Dec 30, 2021
PHP Digital Green Certificate SDK

Digital Green Certificate SDK PHP Indice Contesto Installazione Uso Licenza Dettaglio licenza Contesto Attenzione, questo repository è derivato dalle

null 9 Jan 11, 2022
Esse SDK em PHP foi desenvolvido no intuito de tornar mais prático a integração com nossa API.

Sobre Beedoo SDK Acessar documentação completa da Beedoo API. A API é organizada seguindo a arquitetura REST, boas práticas, convenções e padrões como

Beedoo Edtech 5 Dec 2, 2021
A PHP SDK for accessing the OpenAI GPT-3 API

OpenAI GPT-3 Api Client in PHP Installation You can install the package via composer: composer require orhanerday/open-ai Usage use Orhanerday\OpenAi\

Orhan erday 127 Jan 12, 2022
The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login

Facebook SDK for PHP (v5) This repository contains the open source PHP SDK that allows you to access the Facebook Platform from your PHP app. Installa

Meta Archive 3.1k Jan 10, 2022
PHP SDK for the Sellix Developers API (developers.sellix.io)

PHP SDK for the Sellix Developers API (developers.sellix.io). Quickly get started and create products, payments and more using PHP.

Sellix 2 Jan 8, 2022
Alibaba Cloud SDK for PHP

English | 简体中文 Alibaba Cloud SDK for PHP Alibaba Cloud SDK for PHP is a development kit that supports quick access to products, dependency on Alibaba

Alibaba Cloud 470 Jan 11, 2022
Aliyun OSS SDK for PHP

Alibaba Cloud OSS SDK for PHP README of Chinese Overview Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Clo

Alibaba Cloud 908 Jan 12, 2022
Qiniu Resource (Cloud) Storage SDK for PHP

Qiniu Cloud SDK for PHP 安装 推荐使用 composer 进行安装。可以使用 composer.json 声明依赖,或者运行下面的命令。SDK 包已经放到这里 qiniu/php-sdk 。 $ composer require qiniu/php-sdk 直接下载安装,SD

Qiniu Cloud 785 Jan 6, 2022