最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]微信授权后获取用户信息失败:40001 invalid credential access_token is invalid or not latest hints req_id

WeiXin crifan 1876浏览 0评论

Python中基于Flask的微信wechat-sdk去开发

用代码:

@app.route("/")
def index():
    requestArgs = request.args
    app.logger.debug(‘requestArgs=%s’, requestArgs)
    needRedirect = False
    paraCode = request.args.get(‘code’, ”)
    app.logger.debug(‘paraCode=%s’, paraCode)
    if not paraCode :
        needRedirect = True
    paraState = request.args.get(‘state’, ”)
    app.logger.debug(‘paraState=%s’, paraState)
    # if not paraState :
    #     needRedirect = True
    if needRedirect:
        # 1. redirect url
        redirect_uri = "http://hd.webonn.com"
        authorize_url = wechat.generate_oauth2_authorize_url(redirect_uri)
        app.logger.debug(‘redirect_uri=%s, authorize_url=%s’, redirect_uri, authorize_url)
        return redirect(authorize_url)
    else:
        # 2. get access token
        respAccessToken = wechat.get_oauth2_access_token(paraCode)
        app.logger.debug(‘respAccessToken=%s’, respAccessToken)
        # respAccessToken={u’access_token’: u’5Lnjm56ox1djVEFEIAdvp4HdcHVO1WsEWCDXVIS0zLZc3veMB4KXLMu843h_MpLJ6xLjlHGeclhhhSsErowWCeFMBMC3CbWX4zDezvu_D7M’, u’openid’: u’oswxxxxxxxxxxxxxxxxxxxxxxVVY’, u’expires_in’: 7200, u’refresh_token’: u’QE-prEWTMHrDBqZGcJLYOg5fNqvpVL6qrp2YekXlyWq2agtwsGhO5IIxujpIBwXzUMy80n7d9xiWFZEwrNt10ilFpRkTbwP4cBzQ2df7eUw’, u’scope’: u’snsapi_userinfo’}
        respAccessTokenStr = jsonToStr(respAccessToken)
        app.logger.debug(‘respAccessTokenStr=%s’, respAccessTokenStr)
        # respAccessTokenStr = {
        #     "access_token": "K8EMRg7DTYnElLOgLix0yVIKeSg85KWmChnGK4PZ8T5N2EiHevQZEm6hyMBPfkOh5Hl3r0H_koLFmHuMFuGOXoyLMn-A7IT0ztqPKvi6TIY",
        #     "openid": "oswxxxxxxxxxxxxxxxxxxxxxxVVY",
        #     "expires_in": 7200,
        #     "refresh_token": "wWfqaQyxbAK4WUKwmPeTuSQ7_Nlnxz35xAZ5fu6ZlQseR526zKyemwA7YozbUmbGYSETIpGCi0T-HXMhgKXKVvi5Kon2_4_uWAwhNcxCRBI",
        #     "scope": "snsapi_userinfo"
        # }
        oauth2Access_token = respAccessToken[‘access_token’]
        oauth2Openid = respAccessToken[‘openid’]
        app.logger.debug(‘oauth2Access_token=%s, oauth2Openid=%s’, oauth2Access_token, oauth2Openid)
        respUserInfoDict = wechat.get_oauth2_userinfo(oauth2Access_token, oauth2Openid)
        app.logger.debug(‘respUserInfoDict=%s’, respUserInfoDict)
        respUserInfoStr = jsonToStr(respUserInfoDict)
        app.logger.debug(‘respUserInfoStr=%s’, respUserInfoStr)
        callbackOkStr = u"回调成功: code=%s, state=%s, respAccessTokenStr=%s, respUserInfoStr=%s" % (paraCode, paraState, respAccessTokenStr, respUserInfoStr)
        return make_response(callbackOkStr)

关注了微信公众号后,点击我的活动,进入:

http://hd.webonn.com

结果运行出错:

(SIPEvents) ➜  SIPEvents gunicorn -w 4 -b 127.0.0.1:8080 sipevents:app
[2016-08-21 14:55:17 +0000] [24349] [INFO] Starting gunicorn 19.6.0
[2016-08-21 14:55:17 +0000] [24349] [INFO] Listening at: http://127.0.0.1:8080 (24349)
[2016-08-21 14:55:17 +0000] [24349] [INFO] Using worker: sync
[2016-08-21 14:55:17 +0000] [24354] [INFO] Booting worker with pid: 24354
[2016-08-21 14:55:17 +0000] [24355] [INFO] Booting worker with pid: 24355
[2016-08-21 14:55:17 +0000] [24360] [INFO] Booting worker with pid: 24360
[2016-08-21 14:55:17 +0000] [24361] [INFO] Booting worker with pid: 24361

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:103]:
signature=c6d9d42bf5cd19edee7a2618dc50d6e74c28db20, timestamp=1471762535, nonce=1598988817, echostr=

<div–<——————————————————————————

tmp_list= [‘sipevents’, u’1471762535′, u’1598988817′]
after sort: tmp_list= [u’1471762535′, u’1598988817′, ‘sipevents’]
tmp_str= 14717625351598988817sipevents
tmp_str_encoded= 14717625351598988817sipevents
tmp_str_sha1= <sha1 HASH object @ 0x7f82f4ce3300>
tmp_str_hexdigest= c6d9d42bf5cd19edee7a2618dc50d6e74c28db20
signature= c6d9d42bf5cd19edee7a2618dc50d6e74c28db20
signature OK

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:107]:
wechat check_signature OK

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:115]:
requestMethod=POST

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:118]:
requestData=<xml><ToUserName><![CDATA[gh_ac090a9873a8]]></ToUserName>
<FromUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></FromUserName>
<CreateTime>1471762535</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[http://hd.webonn.com/]]></EventKey>
<MenuId>408577275</MenuId>
</xml>

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:125]:
requestArgs=ImmutableMultiDict([(‘nonce’, u’1598988817′), (‘timestamp’, u’1471762535′), (‘signature’, u’c6d9d42bf5cd19edee7a2618dc50d6e74c28db20′), (‘openid’, u’oswxxxxxxxxxxxxxxxxxxxxxxVVY’)])

<div–<——————————————————————————

data= <xml><ToUserName><![CDATA[gh_ac090a9873a8]]></ToUserName>
<FromUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></FromUserName>
<CreateTime>1471762535</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[http://hd.webonn.com/]]></EventKey>
<MenuId>408577275</MenuId>
</xml>
self.conf.encrypt_mode= normal

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:137]:
parse post body data OK

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:150]:
messageId=0, messageTarget=gh_ac090a9873a8, messageSource=oswxxxxxxxxxxxxxxxxxxxxxxVVY, messageTime=1471762535, messageType=view, messageRaw=<xml><ToUserName><![CDATA[gh_ac090a9873a8]]></ToUserName>
<FromUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></FromUserName>
<CreateTime>1471762535</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[http://hd.webonn.com/]]></EventKey>
<MenuId>408577275</MenuId>
</xml>

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:160]:
respStr=Not Support type of POST

<div–<——————————————————————————

text response= 
    <xml>
    <ToUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></ToUserName>
    <FromUserName><![CDATA[gh_ac090a9873a8]]></FromUserName>
    <CreateTime>1471762535</CreateTime>
    <MsgType><![CDATA[text]]></MsgType>
    <Content><![CDATA[Not Support type of POST]]></Content>
    </xml>

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:68]:
redirect_uri=http://hd.webonn.com, authorize_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9xxxxxxxxxxxxxxd&redirect_uri=http%3A//hd.webonn.com&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:68]:
redirect_uri=http://hd.webonn.com, authorize_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9xxxxxxxxxxxxxxd&redirect_uri=http%3A//hd.webonn.com&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:68]:
redirect_uri=http://hd.webonn.com, authorize_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9xxxxxxxxxxxxxxd&redirect_uri=http%3A//hd.webonn.com&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([(‘state’, u”), (‘code’, u’001u7GCy0ueOLl1lJiBy0TDECy0u7GC8′)])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=001u7GCy0ueOLl1lJiBy0TDECy0u7GC8

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:73]:
respAccessToken={u’access_token’: u’b8roBY5fcnrfqTlUdZw2dxMGGNmS_kQauGQBsVqjKLfnEf8-yzR8ihP0z5nrwmLefJmw5iIrMwZgLfbx9rjSfyOgEBn9fhNpYMzmTPPjIZM’, u’openid’: u’oswxxxxxxxxxxxxxxxxxxxxxxVVY’, u’expires_in’: 7200, u’refresh_token’: u’YowSs3pf1B7mvwuUd-DBWAOw8-X_lky-NMSthFmb_DN4zPfuZPDSgNlT8f_IKggr-PvoZGaa3oGwH8gdw1N9ntG2EGYE4ap4nYzrAHZwds0′, u’scope’: u’snsapi_userinfo’}

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:76]:
respAccessTokenStr={
  "access_token": "b8roBY5fcnrfqTlUdZw2dxMGGNmS_kQauGQBsVqjKLfnEf8-yzR8ihP0z5nrwmLefJmw5iIrMwZgLfbx9rjSfyOgEBn9fhNpYMzmTPPjIZM", 
  "openid": "oswxxxxxxxxxxxxxxxxxxxxxxVVY", 
  "expires_in": 7200, 
  "refresh_token": "YowSs3pf1B7mvwuUd-DBWAOw8-X_lky-NMSthFmb_DN4zPfuZPDSgNlT8f_IKggr-PvoZGaa3oGwH8gdw1N9ntG2EGYE4ap4nYzrAHZwds0", 
  "scope": "snsapi_userinfo"
}

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:87]:
access_token=b8roBY5fcnrfqTlUdZw2dxMGGNmS_kQauGQBsVqjKLfnEf8-yzR8ihP0z5nrwmLefJmw5iIrMwZgLfbx9rjSfyOgEBn9fhNpYMzmTPPjIZM, openid=oswxxxxxxxxxxxxxxxxxxxxxxVVY

<div–<——————————————————————————

[2016-08-21 14:55:39 +0000] [24354] [ERROR] Error handling request /?code=001u7GCy0ueOLl1lJiBy0TDECy0u7GC8&state=
Traceback (most recent call last):
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/share/nginx/html/SIPEvents/sipevents.py", line 88, in index
    respUserInfoDict = wechat.get_oauth2_userinfo(oauth2Access_token, oauth2Openid)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/wechat_sdk-0.6.4-py2.7.egg/wechat_sdk/basic.py", line 628, in get_oauth2_userinfo
    ‘lang’: lang,
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/wechat_sdk-0.6.4-py2.7.egg/wechat_sdk/lib/request.py", line 74, in get
    **kwargs
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/wechat_sdk-0.6.4-py2.7.egg/wechat_sdk/lib/request.py", line 59, in request
    self._check_official_error(response_json)
  File "/root/Envs/SIPEvents/lib/python2.7/site-packages/wechat_sdk-0.6.4-py2.7.egg/wechat_sdk/lib/request.py", line 98, in _check_official_error
    raise OfficialAPIError(errcode=json_data.get(‘errcode’), errmsg=json_data.get(‘errmsg’, ”))
OfficialAPIError: 40001: invalid credential, access_token is invalid or not latest, hints: [ req_id: Y9wvjA0539ns54 ]

搜:

40001: invalid credential, access_token is invalid or not latest, hints: [ req_id: Y9wvjA0539ns54 ]

微信 40001  invalid credential, access_token is invalid or not latest, hints  req_id  Y9wvjA0539ns54

微信 40001  invalid credential, access_token is invalid or not latest

php – 公众号网页授权后获取用户基本信息出现access_token非法提示 – SegmentFault

网页授权获取用户基本信息 – 微信公众平台开发者文档

获取用户基本信息(UnionID机制) – 微信公众平台开发者文档

此处,的确已经是用的:

https://api.weixin.qq.com/sns/userinfo

而不是

https://api.weixin.qq.com/cgi-bin/user/info

但是还是出错。

间接性的出现错误OfficialAPIError: 40001 · Issue #70 · doraemonext/wechat-python-sdk

并发时是否判断有误? · Issue #115 · node-webot/wechat

access_token失效问题-CSDN论坛-CSDN.NET-中国最大的IT技术社区

一个失误导致微信下载图片接口Token失效

一段时间内会出现40001 错误 access_token 无效或不是最新的 – 详情 – 微信问答社区

微信公众平台开发(76) 获取用户基本信息 – 方倍工作室 – 博客园

后来,通过去看库wechat-sdk的代码,知道了原因了:

原来是原先SDK中,默认使用了conf中的access_token,而不是我们所传入进入的access_token

所以,此处,去把代码改为:

(1)wechat_sdk/basic.py

加了调用get时加入额外参数:

access_token = access_token,

变成:

def get_oauth2_userinfo(self, access_token, user_id, lang=’zh_CN’):
    """
    拉取用户信息(需scope为 snsapi_userinfo)
    详情请参考 http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html#.E7.AC.AC.E5.9B.9B.E6.AD.A5.EF.BC.9A.E6.8B.89.E5.8F.96.E7.94.A8.E6.88.B7.E4.BF.A1.E6.81.AF.28.E9.9C.80scope.E4.B8.BA_snsapi_userinfo.29
    :param access_token: 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
    :param user_id: 用户的唯一标识
    :param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
    :return: 返回的 JSON 数据包
    :raise HTTPError: 微信api http 请求失败
    """
    return self.request.get(
        url=’https://api.weixin.qq.com/sns/userinfo’,
        access_token = access_token,
        params={
            ‘access_token’: access_token,
            ‘openid’: user_id,
            ‘lang’: lang,
        }
    )

(2)wechat_sdk/lib/request.py

把:

def request(self, method, url, access_token=None, **kwargs):

中的:

access_token = self.__conf.access_token if self.__conf is not None else access_token

改为:

        if not access_token :
            access_token = self.__conf.access_token if self.__conf is not None else access_token

变成:

def request(self, method, url, access_token=None, **kwargs):
    """
    向微信服务器发送请求
    :param method: 请求方法
    :param url: 请求地址
    :param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
    :param kwargs: 附加数据
    :return: 微信服务器响应的 JSON 数据
    """
    if not access_token :
        access_token = self.__conf.access_token if self.__conf is not None else access_token
    if "params" not in kwargs:
        kwargs["params"] = {
            "access_token": access_token
        }
    else:
        kwargs["params"]["access_token"] = access_token
    if isinstance(kwargs.get("data", ""), dict):
        body = json.dumps(kwargs["data"], ensure_ascii=False)
        if isinstance(body, six.text_type):
            body = body.encode(‘utf8’)
        kwargs["data"] = body
    r = requests.request(
        method=method,
        url=url,
        **kwargs
    )
    r.raise_for_status()
    try:
        response_json = r.json()
    except ValueError:  # 非 JSON 数据
        return r
    headimgurl = response_json.get(‘headimgurl’)
    if headimgurl:
        response_json[‘headimgurl’] = headimgurl.replace(‘\\’, ”)
    self._check_official_error(response_json)
    return response_json

然后就可以正常使用最新的,网页授权的token(而不是全局的token)去正常获取用户信息了:

页面运行效果:

log:

(SIPEvents) ➜  SIPEvents gunicorn -w 4 -b 127.0.0.1:8080 sipevents:app                                                            
[2016-08-21 15:17:31 +0000] [24547] [INFO] Starting gunicorn 19.6.0
[2016-08-21 15:17:31 +0000] [24547] [INFO] Listening at: http://127.0.0.1:8080 (24547)
[2016-08-21 15:17:31 +0000] [24547] [INFO] Using worker: sync
[2016-08-21 15:17:31 +0000] [24552] [INFO] Booting worker with pid: 24552
[2016-08-21 15:17:31 +0000] [24553] [INFO] Booting worker with pid: 24553
[2016-08-21 15:17:31 +0000] [24558] [INFO] Booting worker with pid: 24558
[2016-08-21 15:17:31 +0000] [24559] [INFO] Booting worker with pid: 24559

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:103]:
signature=1519eb5e5bdf0a2d109da6139bfe6a2b97bf1f6c, timestamp=1471763857, nonce=315253569, echostr=

<div–<——————————————————————————

tmp_list= [‘sipevents’, u’1471763857′, u’315253569′]
after sort: tmp_list= [u’1471763857′, u’315253569′, ‘sipevents’]
tmp_str= 1471763857315253569sipevents
tmp_str_encoded= 1471763857315253569sipevents
tmp_str_sha1= <sha1 HASH object @ 0x7fd2b5268300>
tmp_str_hexdigest= 1519eb5e5bdf0a2d109da6139bfe6a2b97bf1f6c
signature= 1519eb5e5bdf0a2d109da6139bfe6a2b97bf1f6c
signature OK

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:107]:
wechat check_signature OK

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:115]:
requestMethod=POST

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:118]:
requestData=<xml><ToUserName><![CDATA[gh_ac090a9873a8]]></ToUserName>
<FromUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></FromUserName>
<CreateTime>1471763857</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[http://hd.webonn.com/]]></EventKey>
<MenuId>408577275</MenuId>
</xml>

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:125]:
requestArgs=ImmutableMultiDict([(‘nonce’, u’315253569′), (‘timestamp’, u’1471763857′), (‘signature’, u’1519eb5e5bdf0a2d109da6139bfe6a2b97bf1f6c’), (‘openid’, u’oswxxxxxxxxxxxxxxxxxxxxxxVVY’)])

<div–<——————————————————————————

data= <xml><ToUserName><![CDATA[gh_ac090a9873a8]]></ToUserName>
<FromUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></FromUserName>
<CreateTime>1471763857</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[http://hd.webonn.com/]]></EventKey>
<MenuId>408577275</MenuId>
</xml>
self.conf.encrypt_mode= normal

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:137]:
parse post body data OK

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:150]:
messageId=0, messageTarget=gh_ac090a9873a8, messageSource=oswxxxxxxxxxxxxxxxxxxxxxxVVY, messageTime=1471763857, messageType=view, messageRaw=<xml><ToUserName><![CDATA[gh_ac090a9873a8]]></ToUserName>
<FromUserName><![CDATA[oswxxxxxxxxxxxxxxxxxxxxxxVVY]]></FromUserName>
<CreateTime>1471763857</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[http://hd.webonn.com/]]></EventKey>
<MenuId>408577275</MenuId>
</xml>

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:160]:
respStr=Not Support type of POST

<div–<——————————————————————————

text response= 
    <xml>
    <ToUserName><![CDATA[oswjmv4X0cCXcfkIwjoDfCkeTVVY]]></ToUserName>
    <FromUserName><![CDATA[gh_ac090a9873a8]]></FromUserName>
    <CreateTime>1471763857</CreateTime>
    <MsgType><![CDATA[text]]></MsgType>
    <Content><![CDATA[Not Support type of POST]]></Content>
    </xml>

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:68]:
redirect_uri=http://hd.webonn.com, authorize_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9xxxxxxxxxxxxxxd&redirect_uri=http%3A//hd.webonn.com&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:68]:
redirect_uri=http://hd.webonn.com, authorize_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9xxxxxxxxxxxxxxd&redirect_uri=http%3A//hd.webonn.com&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([(‘state’, u”), (‘code’, u’001zPAOg1tZlnl0NLMMg1TLFOg1zPAO5′)])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=001zPAOg1tZlnl0NLMMg1TLFOg1zPAO5

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:73]:
respAccessToken={u’access_token’: u’bKuRJkZR9BG-XROJ1TTntYfJtDZ4VRRqTdsny-nPbzROnlPMmd3mrdcxO_j__b7cuA3ZRxCyDcwWOiUVqi91cmf4W7bNNGidf2qXIYjR-Oo’, u’openid’: u’oswjmv4X0cCXcfkIwjoDfCkeTVVY’, u’expires_in’: 7200, u’refresh_token’: u’l0-Db3FmfOsjdrgQUhLJEX5zD5Kjusb7-uEPx4DcuSSTMfru5fOJILaE0jgac0JIbdF0q3LbSXHRMM6v4LW5XLbUFvwtICk4Py9qflOYhFg’, u’scope’: u’snsapi_userinfo’}

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:76]:
respAccessTokenStr={
  "access_token": "bKuRJkZR9BG-XROJ1TTntYfJtDZ4VRRqTdsny-nPbzROnlPMmd3mrdcxO_j__b7cuA3ZRxCyDcwWOiUVqi91cmf4W7bNNGidf2qXIYjR-Oo", 
  "openid": "oswjmv4X0cCXcfkIwjoDfCkeTVVY", 
  "expires_in": 7200, 
  "refresh_token": "l0-Db3FmfOsjdrgQUhLJEX5zD5Kjusb7-uEPx4DcuSSTMfru5fOJILaE0jgac0JIbdF0q3LbSXHRMM6v4LW5XLbUFvwtICk4Py9qflOYhFg", 
  "scope": "snsapi_userinfo"
}

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:87]:
access_token=bKuRJkZR9BG-XROJ1TTntYfJtDZ4VRRqTdsny-nPbzROnlPMmd3mrdcxO_j__b7cuA3ZRxCyDcwWOiUVqi91cmf4W7bNNGidf2qXIYjR-Oo, openid=oswjmv4X0cCXcfkIwjoDfCkeTVVY

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:89]:
respUserInfoDict={u’province’: u’\xe6\xb1\x9f\xe8\x8b\x8f’, u’openid’: u’oswjmv4X0cCXcfkIwjoDfCkeTVVY’, u’headimgurl’: u’http://wx.qlogo.cn/mmopen/ajNVdqHZLLDYtIJicNl7MjwZK5c1lxAJZ253c9v3JzDib7GeE5OFrWiaRqsK1ruW1HmGaziaYETV5vQhIIbic6wHKFQ/0′, u’language’: u’zh_CN’, u’city’: u’\xe8\x8b\x8f\xe5\xb7\x9e’, u’country’: u’\xe4\xb8\xad\xe5\x9b\xbd’, u’sex’: 1, u’privilege’: [], u’nickname’: u’\xe7\xa4\xbc\xe8\xb2\x8c’}

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:91]:
respUserInfoStr={
  "province": "\u00e6\u00b1\u009f\u00e8\u008b\u008f", 
  "openid": "oswjmv4X0cCXcfkIwjoDfCkeTVVY", 
  "headimgurl": "http://wx.qlogo.cn/mmopen/ajNVdqHZLLDYtIJicNl7MjwZK5c1lxAJZ253c9v3JzDib7GeE5OFrWiaRqsK1ruW1HmGaziaYETV5vQhIIbic6wHKFQ/0", 
  "language": "zh_CN", 
  "city": "\u00e8\u008b\u008f\u00e5\u00b7\u009e", 
  "country": "\u00e4\u00b8\u00ad\u00e5\u009b\u00bd", 
  "sex": 1, 
  "privilege": [], 
  "nickname": "\u00e7\u00a4\u00bc\u00e8\u00b2\u008c"
}

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:50]:
requestArgs=ImmutableMultiDict([])

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:55]:
paraCode=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:60]:
paraState=

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in sipevents [/usr/share/nginx/html/SIPEvents/sipevents.py:68]:
redirect_uri=http://hd.webonn.com, authorize_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9xxxxxxxxxxxxxxd&redirect_uri=http%3A//hd.webonn.com&response_type=code&scope=snsapi_userinfo&state=#wechat_redirect

<div–<——————————————————————————

转载请注明:在路上 » [已解决]微信授权后获取用户信息失败:40001 invalid credential access_token is invalid or not latest hints req_id

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
57 queries in 0.108 seconds, using 18.85MB memory