Exemple #1
0
        public async Task <Result <WeChatUserAccessToken> > RefreshUserAccessTokenAsync(string refreshToken, WeChatAppIdSecret overrideIdSecret)
        {
            overrideIdSecret.NotNull();

            var url = $"https://api.weixin.qq.com/sns/oauth2/refresh_token" +
                      $"?appid={overrideIdSecret.AppId}" +
                      $"&refresh_token={refreshToken}" +
                      $"&grant_type=refresh_token";

            return(await GetUserAccessTokenFromResolvedUrlAsync(url));
        }
Exemple #2
0
        public async Task <Result <WeChatUserAccessToken> > GetUserAccessTokenAsync(string code, WeChatAppIdSecret overrideIdSecret)
        {
            overrideIdSecret.NotNull();

            var url = $"https://api.weixin.qq.com/sns/oauth2/access_token" +
                      $"?appid={overrideIdSecret.AppId}" +
                      $"&secret={overrideIdSecret.AppSecret}" +
                      $"&code={code}" +
                      $"&grant_type=authorization_code";

            return(await GetUserAccessTokenFromResolvedUrlAsync(url));
        }