如何在微信中获取时间戳,nonceStr和签名?

时间:2021-05-17 04:14:16

In wechat integration, I need timestamp, nonceStr and signature parameters. How can I get them using the app access_token?

在微信集成中,我需要时间戳,nonceStr和签名参数。如何使用app access_token获取它们?

1 个解决方案

#1


0  

The timestamp, nonceStr and signature are parameters you need to create by yourself. In Javascript, it would be like this :

时间戳,nonceStr和签名是您需要自己创建的参数。在Javascript中,它将是这样的:

   var date = new Date();
   var timestamp = Math.floor(d.getTime() / 1000);
   var nonce = Math.random().toString(36).substr(2, 15);
   var string = "param1=param1&param2=param2&noncestr=" + nonce + "&timestamp=" + timestamp; 
   var signature = SHA1(string);

This is just an exemple. In case of wechat integration, i advise to use this documentation if you dont speak chinese :

这只是一个例子。在微信集成的情况下,如果您不会说中文,我建议使用此文档:

http://admin.wechat.com/wiki/index.php?title=Getting_Started

http://admin.wechat.com/wiki/index.php?title=Access_token

It's not updated but it can help you to figure out what do you need. and then you can compare with the official documentation to get the latest endpoint.

它没有更新,但它可以帮助您弄清楚您需要什么。然后您可以与官方文档进行比较以获取最新的端点。

http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html

#1


0  

The timestamp, nonceStr and signature are parameters you need to create by yourself. In Javascript, it would be like this :

时间戳,nonceStr和签名是您需要自己创建的参数。在Javascript中,它将是这样的:

   var date = new Date();
   var timestamp = Math.floor(d.getTime() / 1000);
   var nonce = Math.random().toString(36).substr(2, 15);
   var string = "param1=param1&param2=param2&noncestr=" + nonce + "&timestamp=" + timestamp; 
   var signature = SHA1(string);

This is just an exemple. In case of wechat integration, i advise to use this documentation if you dont speak chinese :

这只是一个例子。在微信集成的情况下,如果您不会说中文,我建议使用此文档:

http://admin.wechat.com/wiki/index.php?title=Getting_Started

http://admin.wechat.com/wiki/index.php?title=Access_token

It's not updated but it can help you to figure out what do you need. and then you can compare with the official documentation to get the latest endpoint.

它没有更新,但它可以帮助您弄清楚您需要什么。然后您可以与官方文档进行比较以获取最新的端点。

http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html