微信公众号接入开发者模式,服务器配置Token验证

时间:2019-03-01 15:33:23   收藏:0   阅读:358

概述

接入微信公众平台开发,开发者需要按照如下步骤完成:

服务器配置

ASP.NET API业务逻辑解决方案

比如我在微信公众平台服务器配置中进行如下配置:

[Route("api/[controller]")]
[ApiController]
public class MPController : ControllerBase
{
    [HttpGet]
    public ActionResult<string> Get(string signature, string timestamp, string nonce, string echostr)
    {
        string[] tmpArr = { "huayueniansi", timestamp, nonce };
        Array.Sort(tmpArr);// 字典排序

        string tmpStr = string.Join("", tmpArr);
        tmpStr = SHA1Helper.SHA1Crypto(tmpStr);
        tmpStr = tmpStr.ToLower();

        if (tmpStr == signature && !string.IsNullOrWhiteSpace(echostr))
            return echostr;
        return "";
    }
}

原文地址:https://www.jianshu.com/p/001f0ca5abf8

原文:https://www.cnblogs.com/huayueniansi/p/10456348.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!