Some of the basic account registration data you might want to collect in your registration process is private, so it requires requesting extended permissions from the user in the login process. Check out the authentication guide for more details about extended permissions. To request the user's email address and birthday in the login process, use the
perms
argument to the fb:login-button
tag to request the required permissions:This login button will produce an authorization dialog that looks like this:
Once the user authorizes your site, you can fetch those fields from the user's profile:
$user = json_decode(file_get_contents(
'https://graph.facebook.com/me?wrap_access_token=' .
$cookie['oauth_access_token']))->me;
register_user($user->id, $user->email, $user->name, $user->username,
$user->birthday_date);
A user's profile picture can always be accessed at the same URL:
http://graph.facebook.com/UID/picture
http://graph.facebook.com/UID/picture
For example, Mark Zuckerberg's profile picture is http://graph.facebook.com/4/picture. The URL will always refer to the most recent profile picture, which ensures that if a user updates his or her picture on Facebook, those changes will be reflected on your site.
0 comments:
Post a Comment