Ejemplo n.º 1
0
        public virtual async Task <string> Verify(VerifyRequestDto input)
        {
            var options = await _optionsResolver.ResolveAsync();

            if (_signatureChecker.Validate(options.Token, input.Timestamp, input.Nonce, input.Signature))
            {
                return(input.EchoStr);
            }

            return("非法参数。");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 登录凭证校验。通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程。
        /// </summary>
        /// <param name="code">登录时获取的 code</param>
        /// <param name="grantType">授权类型,此处只需填写 authorization_code</param>
        public async Task <Code2AccessTokenResponse> Code2SessionAsync(string code, string grantType = "authorization_code")
        {
            var options = await _optionsResolver.ResolveAsync();

            return(await Code2SessionAsync(options.AppId, options.AppSecret, code, grantType));
        }
Ejemplo n.º 3
0
        public virtual async Task <string> GetAccessTokenAsync()
        {
            var options = await _weChatOfficialOptionsResolver.ResolveAsync();

            return(await _accessTokenProvider.GetAccessTokenAsync(options.AppId, options.AppSecret));
        }