我正在尝试使用Xamarin在Android手机上使用.NET API上传视频。我无法进行身份验证,并在主题行中收到错误。以下是Xamarin的代码:
我使用了HttpScoop,似乎没有网络流量。
我正在使用网络应用程序ID:
网络应用程序的客户端ID
客户ID:
* .apps.googleusercontent.com
电子邮件地址:
* @ developer.gserviceaccount.com
客户密码:
- * 的
重定向URI:http://jmawebtechnologies.com
JavaScript起源:http://jmawebtechnologies.com
以下是我创建Google身份验证器的方法:
GoogleAuthenticator Auth ()
{
return new Google.Apis.Authentication.OAuth2.GoogleAuthenticator (ClientID, new Uri ("http://jmawebtechnologies.com"), Google.Apis.Youtube.v3.YoutubeService.Scopes.YoutubeUpload.ToString());
}
答案 0 :(得分:0)
我发现我必须调用GetUI。这将打开一个用户登录Google的浏览器窗口。
StartActivity(auth2.GetUI (this));
auth2.Completed += (sender, eventArgs) => {
if (eventArgs.IsAuthenticated) {
MakeAlert("Is auth", "Accepted!");
} else {
// The user cancelled
MakeAlert("Is not auth", "failure");
}
};