收藏
回答

刚获取的tocken就过期

刚获取tocken,然后拿去获取小程序码,返回结果总是提示tocken过期了。代码如下:

@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!]"}


请问有没有人遇到过这种问题啊?在线等,急急急!

回答关注问题邀请回答
收藏

4 个回答

  • Ace
    Ace
    2018-09-19

    我也遇到这么问题了。

    2018-09-19
    有用
    回复
  • 小`^智
    小`^智
    2018-06-30

    注意token和account_token,获取微信二维码使用的account_token和微信支付授权等token不是同一个接口获取的


    2018-06-30
    有用
    回复
  • จุ๊บ
    จุ๊บ
    2018-05-17

    AppSecret应该是正确的吧,获取open Id的时候都能用。

    2018-05-17
    有用
    回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2018-05-17

    你好

    2018-05-17
    有用
    回复 1
    • 1米阳光
      1米阳光
      2020-07-23
      你能帮我看一下,我这边的问题吗?
      2020-07-23
      回复
登录 后发表内容