C# Xamarin形成谷歌认证
我正试图通过遵循这一点并使用插件来实现Google身份验证 我非常仔细地遵循了所有步骤: sha密钥,IOs上的密钥链,授权谷歌协议,Firebase。。但是我有两个错误: 关于Andoid: 我有一个错误:GoogleClientBaseException 错误:“10:” 在IOS上: 我有一个错误:GoogleClientBaseException 错误:“读取或写入应用程序密钥链时出现问题” 一个按钮通过调用函数“OnLogGoogle”启动身份验证 代码如下:C# Xamarin形成谷歌认证,c#,.net,xamarin.forms,C#,.net,Xamarin.forms,我正试图通过遵循这一点并使用插件来实现Google身份验证 我非常仔细地遵循了所有步骤: sha密钥,IOs上的密钥链,授权谷歌协议,Firebase。。但是我有两个错误: 关于Andoid: 我有一个错误:GoogleClientBaseException 错误:“10:” 在IOS上: 我有一个错误:GoogleClientBaseException 错误:“读取或写入应用程序密钥链时出现问题” 一个按钮通过调用函数“OnLogGoogle”启动身份验证 代码如下: IGoogleClien
IGoogleClientManager _googleService = CrossGoogleClient.Current; //Plugin.GoogleClient
private async void OnLogGoogle(object senderApp, EventArgs eApp)
{
_googleService.OnLogin += OnLoginCompleted;
try
{
await _googleService.LoginAsync();
}
catch (GoogleClientSignInNetworkErrorException e)
{
await App.Current.MainPage.DisplayAlert("Error1", e.Message, "OK");
}
catch (GoogleClientSignInCanceledErrorException e)
{
await App.Current.MainPage.DisplayAlert("Error2", e.Message, "OK");
}
catch (GoogleClientSignInInvalidAccountErrorException e)
{
await App.Current.MainPage.DisplayAlert("Error3", e.Message, "OK");
}
catch (GoogleClientSignInInternalErrorException e)
{
await App.Current.MainPage.DisplayAlert("Error4", e.Message, "OK");
}
catch (GoogleClientNotInitializedErrorException e)
{
await App.Current.MainPage.DisplayAlert("Error5", e.Message, "OK");
}
catch (GoogleClientBaseException e)
{
await App.Current.MainPage.DisplayAlert("Error6", e.Message, "OK");
}
}
private void OnLoginCompleted(object sender, GoogleClientResultEventArgs<GoogleUser> loginEventArgs)
{
if (loginEventArgs.Data != null)
{
GoogleUser googleUser = loginEventArgs.Data;
/* User.Name = googleUser.Name;
User.Email = googleUser.Email;
User.Picture = googleUser.Picture;
var GivenName = googleUser.GivenName;
var FamilyName = googleUser.FamilyName;*/
// Log the current User email
Console.WriteLine("email "+ googleUser.Email);
var token = CrossGoogleClient.Current.AccessToken;
var Token = token;
}
else
{
App.Current.MainPage.DisplayAlert("Error", loginEventArgs.Message, "OK");
}
_googleService.OnLogin -= OnLoginCompleted;
}
IGoogleClientManager\u googleService=CrossGoogleClient.Current//Plugin.GoogleClient
私有异步void OnLogGoogle(对象senderApp、事件args eApp)
{
_googleService.OnLogin+=OnLoginCompleted;
尝试
{
wait_googleService.LoginAsync();
}
捕获(谷歌客户端信号网络错误)
{
等待App.Current.MainPage.DisplayAlert(“Error1”,即消息“OK”);
}
捕获(GoogleClientSignInCanceledErrorException e)
{
等待App.Current.MainPage.DisplayAlert(“Error2”,即消息“OK”);
}
捕获(谷歌客户端签名无效)
{
等待App.Current.MainPage.DisplayAlert(“Error3”,即消息“OK”);
}
捕获(谷歌客户端签名内部错误例外)
{
等待App.Current.MainPage.DisplayAlert(“Error4”,即消息“OK”);
}
catch(谷歌客户端未初始化错误)
{
等待App.Current.MainPage.DisplayAlert(“Error5”,即消息“OK”);
}
catch(googleclientbasee异常)
{
等待App.Current.MainPage.DisplayAlert(“Error6”,即消息“OK”);
}
}
private void OnLoginCompleted(对象发送者、Google ClientResultEventArgs loginEventArgs)
{
if(loginEventArgs.Data!=null)
{
GoogleUser GoogleUser=loginEventArgs.Data;
/*User.Name=googleUser.Name;
User.Email=googleUser.Email;
User.Picture=googleUser.Picture;
var GivenName=googleUser.GivenName;
var FamilyName=googleUser.FamilyName*/
//记录当前用户的电子邮件
控制台.WriteLine(“电子邮件”+谷歌用户.email);
var token=CrossGoogleClient.Current.AccessToken;
var-Token=Token;
}
其他的
{
App.Current.MainPage.DisplayAlert(“错误”,loginEventArgs.Message,“确定”);
}
_googleService.OnLogin-=OnLoginCompleted;
}
Hi,来自共享链接,它不支持xamarin表单。你可以看看这个样品。Google不再允许Webview身份验证