尝试获取UserCredential时,在应用程序内置的c#WebBrowser组件上显示身份验证页面

尝试获取UserCredential时,在应用程序内置的c#WebBrowser组件上显示身份验证页面,c#,wpf,google-api-dotnet-client,C#,Wpf,Google Api Dotnet Client,我使用了下面的代码片段来检索之前的UserCredential UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(...); 首次身份验证时,它将启动默认浏览器并显示身份验证页面 现在我想在我的WPF应用程序中添加WebBrowser组件,我想在我的内置WebBrowser组件上显示身份验证页面,但我找不到实现它的方法 非常感谢您的帮助。目前Google.net客户端库不支持此功能。目前,Google

我使用了下面的代码片段来检索之前的
UserCredential

UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(...);
首次身份验证时,它将启动默认浏览器并显示身份验证页面

现在我想在我的
WPF
应用程序中添加
WebBrowser
组件,我想在我的内置
WebBrowser
组件上显示身份验证页面,但我找不到实现它的方法


非常感谢您的帮助。

目前Google.net客户端库不支持此功能。目前,GoogleWebAuthorizationBroker.AuthorizationAsync只打开一个新浏览器,无法获取授权URI以将其嵌入您自己的webbrowser组件中

有一个windows phone用户控件的例子,我还没有亲自测试过。也许会有帮助

<UserControl x:Class="Google.Apis.Auth.OAuth2.WebAuthenticationBrokerUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    mc:Ignorable="d"
    x:ClassModifier="internal"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" 
          HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <phone:WebBrowser Name="browser"
                          IsScriptEnabled="True"
                          Navigating="OnBrowserNavigating"
                          NavigationFailed="OnBrowserNavigationFailed"
                          Navigated="OnBrowserNavigated" />
        <ProgressBar Name="Loader" Height="10" Margin="10" VerticalAlignment="Top" IsIndeterminate="True" />
    </Grid>
</UserControl>

客户端库的源代码可以在它上面找到,因为它是一个开源项目,所以欢迎您将它添加到项目中


目前还有一个问题请求

目前Google.net客户端库不支持这一点。目前,GoogleWebAuthorizationBroker.AuthorizationAsync只打开一个新浏览器,无法获取授权URI以将其嵌入您自己的webbrowser组件中

有一个windows phone用户控件的例子,我还没有亲自测试过。也许会有帮助

<UserControl x:Class="Google.Apis.Auth.OAuth2.WebAuthenticationBrokerUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    mc:Ignorable="d"
    x:ClassModifier="internal"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" 
          HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <phone:WebBrowser Name="browser"
                          IsScriptEnabled="True"
                          Navigating="OnBrowserNavigating"
                          NavigationFailed="OnBrowserNavigationFailed"
                          Navigated="OnBrowserNavigated" />
        <ProgressBar Name="Loader" Height="10" Margin="10" VerticalAlignment="Top" IsIndeterminate="True" />
    </Grid>
</UserControl>

客户端库的源代码可以在它上面找到,因为它是一个开源项目,所以欢迎您将它添加到项目中

目前还有一个问题请求