【问题标题】:Google Friend Connect fcauth cookie in phpphp 中的 Google 朋友群 fcauth cookie
【发布时间】:2010-08-26 08:26:49
【问题描述】:

这对你们大多数人来说可能很容易......但我不是。

我正在使用一些“示例”Google 代码 - 因为它符合我的目的,所以为什么要更改有效的方法 - 但在我的一生中,我无法在用户登录后访问/查找/获取等 FCAuth cookie。

请帮助 - 在此先感谢。

这是我的代码(站点 ID 在一个集合变量中,所有调用都有效。只需要查找/获取 FCAuth cookie。

    var viewer, ownerFriends, activities;
google.friendconnect.container.setParentUrl('/api/' /* location of rpc_relay.html and canvas.html */);
google.friendconnect.container.loadOpenSocialApi({ 
site: SITE_ID,
onload: function() { initAllData(); }});

function initAllData() {
  var params = {};
  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
    [opensocial.Person.Field.ID,opensocial.Person.Field.NAME,opensocial.Person.Field.THUMBNAIL_URL,opensocial.Person.Field.PROFILE_URL];
  var req = opensocial.newDataRequest();
  req.add(req.newFetchPersonRequest('VIEWER', params), 'viewer');
  req.add(req.newFetchPeopleRequest(

   new opensocial.IdSpec({'userId' : 'OWNER', 'groupId' : 'FRIENDS'}), params), 
    'ownerFriends');
  req.add(req.newFetchActivitiesRequest(new opensocial.IdSpec({'userId' : 'OWNER', 'groupId' : 'FRIENDS'})), 'activities');

  var idspec = new opensocial.IdSpec({ 'userId' : 'VIEWER','groupId' : 'FRIENDS' });
  req.add(req.newFetchPeopleRequest(idspec), 'viewer_friends');
  req.send(onData);
  req.send(setupData);

};

function setupData(data) {
  ownerFriends = data.get('ownerFriends').getData().asArray();
  var html = "";
  for (var i = 0; i < ownerFriends.length && i < 8; i++) {
    var person = ownerFriends[i];
    html += "<a title='" + person.getField("displayName") + "' href='" + person.getField("profileUrl") + "'>";
    html += "<img class='memberPhoto' src='" + person.getField("thumbnailUrl")  + "' width='50px' alt='" + person.getField("displayName") + "'/>";
    html += "</a>&nbsp;&nbsp;";
  };

  document.getElementById('members').innerHTML = html;

  viewer = data.get('viewer').getData();
  if (viewer) {
    document.getElementById('memberstate').innerHTML = 
    '<h2>' + viewer.getField("displayName") + ' welcome to the Yoga Council of Canada </h2>' ;
  } else {
    document.getElementById('memberstate').innerHTML = 
    '<h2>Join with one click</h2> After joining, you will automatically appear as a recent member.';
  }

  viewer = data.get('viewer').getData();
  if (viewer) {
    document.getElementById('profile').innerHTML = 
    '<img align="left" src="' + viewer.getField("thumbnailUrl")  + '" style="margin-right: 20px;" >' +
    '<strong>' +  viewer.getField("displayName") + '</strong><br>' +
    '<a href="#" onclick="google.friendconnect.requestSettings(); return false;">Settings</a><br>' +
    '<a href="#" onclick="google.friendconnect.requestInvite(\'Come and join the Yoga Council of Canada \'); return false;">Invite a friend</a><br>' +
    '<a href="#" onclick="google.friendconnect.requestSignOut(); return false;">Sign out</a><br>';
  } else {
    google.friendconnect.renderSignInButton({ 'id': 'profile' });
  }

};

function onData(data) {
if (!data.get("viewer_friends").hadError()) {
  var site_friends = data.get("viewer_friends").getData();
  var list = document.getElementById("friends-list");
  list.innerHTML = "";
  site_friends.each(function(friend) {
    list.innerHTML += "<li>" + friend.getDisplayName() + "</li>";
  });
}

};

【问题讨论】:

    标签: cookies facebook friend


    【解决方案1】:

    好的,我/当时很厚,cookie自动设置为

    $_COOKIE['fcauth<your appID>'];
    

    所以你可以“直接调用它”,即

    <?php if($_COOKIE['fcauth<your appID>']): do something endif; ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多