public async Task <ViewResult> AuthRedirectAsync(string auth_code, int expires_in) { ViewBag.AuthCode = auth_code; ViewBag.ExpiresIn = expires_in; if (_memoryCache.TryGetValue(nameof(ComponentVerifyTicketNotifyModel), out ComponentVerifyTicketNotifyModel componentVerifyTicketNotifyModel)) { if (!_memoryCache.TryGetValue(nameof(ApiComponentTokenResponse), out ApiComponentTokenResponse apiComponentTokenResponse)) { apiComponentTokenResponse = await _component.ApiComponentToken(new ApiComponentTokenRequest() { ComponentAppId = _optionsSnapshotOfWeChatComponentOptions.Value?.AppId, ComponentAppSecret = _optionsSnapshotOfWeChatComponentOptions.Value?.AppSecret, ComponentVerifyTicket = componentVerifyTicketNotifyModel.ComponentVerifyTicket }); _memoryCache.Set(nameof(ApiComponentTokenResponse), apiComponentTokenResponse); } ApiQueryAuthResponse apiQueryAuthResponse = await _component.ApiQueryAuth(apiComponentTokenResponse.ComponentAccessToken, new ApiQueryAuthRequest() { AuthorizationCode = auth_code, ComponentAppId = _optionsSnapshotOfWeChatComponentOptions.Value?.AppId }); _memoryCache.Set(nameof(ApiAuthorizerTokenResponse), apiQueryAuthResponse as ApiAuthorizerTokenResponse); } return(View()); }