0

I am integrating GFC with my web app (PHP). In this app I have a list of user IDs and I need to fetch their profile details like their display name, profile pic url etc. using a HTTP call.

For example, I am trying to fetch data of user with id: $userId = 1234567

If a viewer (need not the user with above id) is logged in, I am able to fetch data by making a call to following URL.

http://www.google.com/friendconnect/api/people/$userId/@self?fcauth=$fcauth

But, if viewer is not logged in, the above URL replies the following

Anonymous requests are not allowed to fetch data

Error 401

I would like to know what URL should be used to fetch the user data even if no one is logged in.

Thanks!!

Goje87
  • 2,839
  • 7
  • 28
  • 48
  • It's not possible, you need to at least have some sort of identifiers of the user before you can get their information. – HChen Mar 19 '11 at 14:59
  • Hi @Haochi, I was trying to fetch the data of a user whose user Id is known. This user need not be the viewer (the one who's currently logged in). I have edited the question to make it more clear. Thanks :) – Goje87 Mar 19 '11 at 15:12
  • I haven't played with OAUTH/Friend Connect for a while but I remember you will have to store some sort of secret token returned by FriendConnect when the user (with the $userID) logs in. http://code.google.com/apis/friendconnect/docs/opensocial_rest_rpc.html#2-legged – HChen Mar 19 '11 at 15:51

1 Answers1

0

The fcauth mechanism is designed for access while the user is online. The fcauth tokens expire fairly rapidly, and no guarantee is made about how long they're valid for. You should assume that they'll only work while the user is online.

If you need offline access, you need to use OAuth. OAuth tokens are valid until manually revoked.

The API call you're making is the correct one, you just need to do it with OAuth instead of fcauth.

Bob Aman
  • 32,839
  • 9
  • 71
  • 95