Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 微信收货地址无法成功 #359

Closed
Jamlee opened this issue Mar 24, 2016 · 7 comments
Closed

[BUG] 微信收货地址无法成功 #359

Jamlee opened this issue Mar 24, 2016 · 7 comments

Comments

@Jamlee
Copy link

Jamlee commented Mar 24, 2016

问题及现象

官方文文档上说收货地址的access_token 是 通过静默授权来得到的,

注意,用网页授权接口,获取accessToken的scope是snsapi_base(和前端网页JavaScript API传入的scope不同)。因为使用了网页授权接口,url是经过微信回调后打开的,所以参与签名使用的url必须带上微信服务器返回的code和state参数。

但是 wechat 库里面 确是 通过直接获取的。这应该不是一个概念吧。

@overtrue
Copy link
Collaborator

但是 wechat 库里面 确是 通过直接获取的 代码呢?

@ancon
Copy link

ancon commented Mar 24, 2016

微信的收货地址的签名错误,多了一个key值.
同时,url的值也传输的不对,没有带code和state.

@ancon
Copy link

ancon commented Mar 24, 2016

希望大神尽快解决,谢谢~

@ancon
Copy link

ancon commented Mar 24, 2016

代码在Payment.php
$accessToken = $accessToken->getToken();
这个值用来签名是不对的~
不知道改成这样对不对
$app = app('EasyWeChat\Foundation\Application');
$accessToken2 = $app->access_token;
$token = $accessToken2->getToken(true);
但是,url的值怎么拼接就不知道了

@overtrue
Copy link
Collaborator

@ancon 加我QQ?44294631

@alwaystrong
Copy link

今天也遇到了这个问题。签名的地址需要拼接oauth过程code和state,否则会有错误:eidt_ address:fail或者eidtAddress:fail_auth_error

overtrue added a commit that referenced this issue Mar 25, 2016
@JellyBool
Copy link

本来也想提个issue的,(用户反映,我看了一下源码)好像遇到了一样的问题,貌似是由于

 $signParams = [
            'appid' => $params['appId'],
            'url' => UrlHelper::current(),
            'timestamp' => $params['timeStamp'],
            'noncestr' => $params['nonceStr'],
            'accesstoken' => $accessToken,
        ];

这个 UrlHelper::current()引起的,根据微信的文档,我们应该还是要CODESTATE这两个参数,最后的url会是类似下面这个样子:

url=http://open.weixin.qq.com/?code=CODE&state=STATE 
//所以在这里基本上解决的问题是:UrlHelper::current()带上CODE和STATE

文档地址: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_8&index=7

overtrue added a commit to EasyWeChat/docs that referenced this issue Mar 25, 2016
overtrue added a commit that referenced this issue Mar 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants