刚获取的tocken就过期
刚获取tocken,然后拿去获取小程序码,返回结果总是提示tocken过期了。代码如下:
[@Test](/user/Test) public void httpTest(){ String url = "https://api.weixin.qq.com/cgi-bin/token" ; String params = "grant_type=client_credential&appid=" + appId + "&secret=" + secret; String result = HttpRequest.sendGet(url,params); System.out.println( "---->" ); String tocken = result.toLowerCase(); String Codeurl = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + tocken; String codeParms = "page=/index/index&width=200&scene=1&is_hyaline=false&auto_color=false&line_color={“r”:”0”,”g”:”0”,”b”:”0”}" ; String codeRes = HttpRequest.sendPost(Codeurl, codeParms); System.out.println( "获取二维码成功!" ); System.out.println(codeRes); } |
返回结果如下:
{ "errcode" : 40001 , "errmsg" : "invalid credential, access_token is invalid or not latest hint: [2YYoSa06932862!]" } |
请问有没有人遇到过这种问题啊?在线等,急急急!