使用webview2成功检索认证数据

问题描述 投票:0回答:1

上下文:我创建了一个Windows服务,它将检索电子邮件并将它们放置在为此目的提供的文件夹中,并且您必须进行身份验证,但谷歌必须通过embeddedview禁用令牌选项,所以我用

webview2
制作了一个winfor 我覆盖
LocalServerCodeReceiver.OpenBrowser
去做
webView.CoreWebView2.Navigate(_urlAuth);
我的问题是在

private void WebView_CoreWebView2ResponseReceived(object sender,CCoreWebView2WebResourceResponseReceivedEventArgs e)

我不知道哪个 catch 部分告诉我我的身份验证成功了

您知道标头告诉我 API 身份验证正常吗?

c# webview google-oauth
1个回答
0
投票

抱歉问这个问题,但经过 4 个小时的搜索我找到了。 有必要这样做

  private void CoreWebView2_NavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e)
    {
        if (e.Uri.StartsWith(_redirectUri))
        {
            DialogResult = DialogResult.OK;
            this.Close();
        }
    }
© www.soinside.com 2019 - 2024. All rights reserved.