Google 好友连接 - 关于 API 和 .net 变量的简单问题

发布于 2024-08-18 07:43:48 字数 109 浏览 6 评论 0原文

我想将登录人员的 Person.Field.ID 号码存储在 .aspx .net 变量中,以便我可以在 VB 脚本中使用它。我正在我的网站上使用登录小工具。我该怎么做?

I want to store the Person.Field.ID number of a logged-in person in a .aspx .net variable so that I can use it in a VB script. I am using the sign-in gadget on my site. How do I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灵芸 2024-08-25 07:43:48

查看 .NET OpenSocial 客户端库C# 端口 href="http://chow-down.appspot.com/" rel="nofollow noreferrer">吃东西。这将是在 .NET 中提取当前查看器的 GFC ID 的两种替代方法,但如果您想使用它,您可能必须将后者从 C# 转换为 VB.NET,因为它不是共享库。不幸的是,我认为客户端库在编写时并未考虑到 Google 朋友群,因此更简单的 fcauth 方法可能不可用。您必须完成双腿 OAuth 流程。我假设客户端库支持这一点,因为它是 Java 版本的端口,确实如此。

如果这一切听起来太复杂,而您真正需要的只是 ID,您可以通过简单的 Ajax/XHR 调用将其传回。以下是用于获取 ID 的 JS API 调用:

var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
req.send(function(response) {
  var data = response.get('viewer').getData();
  if (data) {
    visitorId = data.getId();
    // Send the ID to your server via Ajax/XHR here
  } else {
    // Not logged in
    visitorId = null;
  }
});

更新:您可能还对 Brian Clifton 刚刚发布的项目感兴趣:friendconnect-dotnet

Check out the .NET OpenSocial client library and the C# port of the Chow Down. These would be two alternate methods for pulling in the GFC ID of the current viewer in .NET, though you'd probably have to translate the latter from C# to VB.NET if you wanted to use it, since it's not a shared library. Unfortunately, I don't think the client library was written with Friend Connect in mind, so the simpler fcauth method probably isn't available. You'll have to go through the 2-legged OAuth process. I assume the client library supports this, since it's a port of the Java version, which does.

If all that sounds too complicated, and all you really need is the ID, you might just pass it back with a simple Ajax/XHR call. Here's the JS API call for getting the ID:

var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
req.send(function(response) {
  var data = response.get('viewer').getData();
  if (data) {
    visitorId = data.getId();
    // Send the ID to your server via Ajax/XHR here
  } else {
    // Not logged in
    visitorId = null;
  }
});

Update: You may also be interested in the project that Brian Clifton just released: friendconnect-dotnet

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文