【发布时间】:2014-09-11 00:16:54
【问题描述】:
我正在使用 Xamarin.Android 开发应用程序。
我需要启用 Facebook 和 Google 登录,并且我选择使用 Xamarin.Auth 组件。 我可以在 facebook 上使用它,但我在使用 Google 时遇到了一些问题。
这是我的代码:
var auth = new OAuth2Authenticator (
clientId: "myId.apps.googleusercontent.com",
clientSecret: "mysecred",
scope: "openid",
authorizeUrl: new Uri ("https://accounts.google.com/o/oauth2/auth"),
redirectUrl: new Uri ("myredirect:oob"),
accessTokenUrl: new Uri ("https://accounts.google.com/o/oauth2/token"),
getUsernameAsync: null
);
activity.StartActivity (auth.GetUI (activity));
auth.Completed += (sender, e) => {
Console.WriteLine (e.IsAuthenticated);
};
谷歌活动是这样显示的吗,我可以插入我的用户名和密码。但是当我点击谷歌登录按钮时,我会收到这样的消息:
google auth 请将此代码开关复制到您的应用程序并将其粘贴到那里[代码]
我与该代码有什么关系?我只需要获取用户名/姓氏/电子邮件/id。
非常感谢!
【问题讨论】:
-
你有解决这个问题的办法吗?
-
@user3471528,你得到解决方案了吗
标签: android oauth-2.0 xamarin xamarin.android