首页 > 解决方案 > Xamarin.Forms:谷歌的 Firebase 身份验证

问题描述

第一个例外:

System.ComponentModel.Win32Exception: Cannot find the specified file

第二个例外:

System.NotSupportedException: Failed to launch browser with "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&response_type=code&client_id=3googleclientid...m&redirect_uri=http%3A%2F%2F127.0.0.1%3A38429%2Fauthorize%2F&scope=email%20profile" for authorization. See inner exception for details.

这是我的代码:

                 var cr = new PromptCodeReceiver();

        \\ the exception is here AuthorizeAsync()

                var result = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    new ClientSecrets {ClientId = GoogleClientId},
                    new[] {"email", "profile"},
                    "user",
                    CancellationToken.None);

                if (result.Token.IsExpired(SystemClock.Default))
                {
                    await result.RefreshTokenAsync(CancellationToken.None);
                }

我正在尝试遵循 https://github.com/step-up-labs/firebase-authentication-dotnet中的代码示例

我正在使用他们的插件。但是我不明白出了什么问题。我能够连接到 firebase 并使用电子邮件和密码创建登录名。但不适用于谷歌 API。

如果我将异常中的地址放入 chrome 这就是我得到的在此处输入图像描述

标签: c#xamarin.formsfirebase-authentication

解决方案


推荐阅读