公众号是认证服务号,网页登陆配置的回调页面地址为:www.h-p-x.com。跟着教程,操作了好几遍了还是不行,Google了没找到成功的解决方案,有没有遇到同样问题的呢?
.env文件
WECHAT_OAUTH_SCOPES=snsapi_userinfo
WECHAT_OAUTH_CALLBACK=www.h-p-x.com
wechat.php配置文件
'wechat_oauth_scopes' => env('WECHAT_OAUTH_SCOPES','your-scopes'),
'wechat_oauth_callback' => env('WECHAT_OAUTH_CALLBACK','your-callback'),
route路由文件
Route::group(['middleware' => ['web', 'wechat.oauth']], function () {
Route::get('/user', function () {
$user = session('wechat.oauth_user'); // 拿到授权用户资料
return view('user',compact('user'));
});
});
wechat日记文件
[2016-04-19 22:54:30] easywechat.DEBUG: Current configuration: {"debug":true,"use_laravel_cache":true,"app_id":"wxa2a186a68def0e2c","secret":"5aae87659bae4d59f397b934eb607e0d","token":"wechat","aes_key":"Z1klgyrJGpxLfuc4PS2RR9E55p9kqJWMrYyGSFPY5FV","log":{"level":"debug","file":"/var/www/wechat_riguo/storage/logs/wechat.log"},"wecaht_oauth_scopes":"snsapi_userinfo","wechat_oauth_callback":"www.h-p-x.com"} []
[2016-04-19 22:54:30] easywechat.DEBUG: Request received: {"Method":"POST","URI":"/wechat?signature=8616325fed9505145212c6adb03cf6563f04f820×tamp=1461077669&nonce=1084037041","Query":"nonce=1084037041&signature=8616325fed9505145212c6adb03cf6563f04f820×tamp=1461077669","Protocal":"HTTP/1.0","Content":"<xml><ToUserName><![CDATA[gh_55bca6c8addb]]></ToUserName>\n<FromUserName><![CDATA[o7-jmwSIG1S37CM7v9JTQtUmKM1Y]]></FromUserName>\n<CreateTime>1461077669</CreateTime>\n<MsgType><![CDATA[event]]></MsgType>\n<Event><![CDATA[VIEW]]></Event>\n<EventKey><![CDATA[http://h-p-x.com/user]]></EventKey>\n<MenuId>403324681</MenuId>\n</xml>"} []
[2016-04-19 22:54:30] easywechat.DEBUG: Message detail: {"ToUserName":"gh_55bca6c8addb","FromUserName":"o7-jmwSIG1S37CM7v9JTQtUmKM1Y","CreateTime":"1461077669","MsgType":"event","Event":"VIEW","EventKey":"http://h-p-x.com/user","MenuId":"403324681"} []
[2016-04-19 22:54:30] easywechat.DEBUG: Server response created: {"response":"success"} []
[2016-04-19 22:54:30] easywechat.DEBUG: Current configuration: {"debug":true,"use_laravel_cache":true,"app_id":"wxa2a186a68def0e2c","secret":"5aae87659bae4d59f397b934eb607e0d","token":"wechat","aes_key":"Z1klgyrJGpxLfuc4PS2RR9E55p9kqJWMrYyGSFPY5FV","log":{"level":"debug","file":"/var/www/wechat_riguo/storage/logs/wechat.log"},"wecaht_oauth_scopes":"snsapi_userinfo","wechat_oauth_callback":"www.h-p-x.com"} []