c# - 适用于 Android Xamarin 的 Google 帐户登录集成

标签 c# .net xamarin xamarin.android monodevelop

我需要将 google 登录集成到 android xamarin 应用程序。 通过以下链接的代码: http://motzcod.es/post/67077106339/google-plus-services-login-and-1-in-xamarin-android

它显示错误连接失败并且 [GooglePlayServicesUtil] Google Play Store 丢失。 甚至经常添加 google play service(Froyo) 组件。

即使我浏览了下面的链接 https://developers.google.com/+/mobile/android/sign-in

Android: Login using google account?

Google Login For Android App

但这与使用java代码的android eclipse有关。 任何人都可以建议我如何在 xamarin 中执行此操作。任何提示/链接表示赞赏。 谢谢。

最佳答案

最后,我通过研究 xamarin 论坛和 stackoverflow 中的可用代码得到了解决方案。 我使用了 OAuth2Authenticator

  1. 在谷歌开发者控制台中注册为 web 应用程序而不是已安装的应用程序 (android)* 提供具有有效 url 的重定向 url ("http://abcd.com/xyz.aspx ") 应在应用程序代码中使用相同的 url。

    <
  2. 认证完成后返回access_token

  3. 使用access_token发起REST请求获取用户完整信息(https://www.googleapis.com/oauth2/v1/userinfo?access_token= "+ accessTokenValue + ".)

  4. 反序列化 json 响应以获取对象中的信息。

*If we registered in developer console as installed application(like android) after making OAuth2Authenticator request it will show window with message please copy this code switch to your application and paste it there [code] manually need to close the window and proceed to authentication. to get ride of this webapplication type is choosen.

引用更多信息。 : Login by google account integration for Xamarin.Android and Xamarin.iOS

关于c# - 适用于 Android Xamarin 的 Google 帐户登录集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25520180/

相关文章:

c# - 如何使 RadioButton 文本和附加标签保持对齐?

android - Xamarin.Forms.Labs Mediapicker 卡在 Android 上尝试使用异步方法从照片库中提取图像

c# - Xamarin、MySQL 异常 : unable to connect to any specific host

javascript - `cond ? true : false` 曾经是好的语法吗?

c# - 如何使用状态代码设置自定义异常

C# 基于split的List去重

.net - 用于调试和发布构建的 WinDbg 不同堆栈跟踪

c# - ASP.NET Web api 上的文件上传端点损坏文件

.net - 无法将仅 http 的 cookie 从 .net api 传递到 next-auth,然后传递到前端

ios - 更新到 Xamarin touch 8.2 并使用 mvvmcross