Get Facebook User Id of my website visitors w/o auth - facebook

Is there any way to get the Facebook User Id of visitors in my website by using the FB API, but without need to ask them to authenticate my Facebook app?
All I need is some facebook-related-identifier, it does not even have to be the User Id, but any kind of identifier that can relate the user to a facebook profile.
Ideas?

If the user does not explicitly authorize you to get some private data from his Facebook account (included his Facebook ID), you can not get them.
I cannot think of a way to get the Facebook ID without the authorization of the user.
Hope that helps.

Related

Login with Facebook integration without registering the website with facebook

I want to use "LOGIN with Facebook" function for the new website. I have created a page with a Facebook login.
When I am trying to get code from:
https://developers.facebook.com/docs/reference/plugins/login/
It is asking me to create an Application.
So my question is Can I use "Login with facebook" functionality without Facebook Application integration?
No, you can't. Even when you retrieve the code you need for the Login plugin, Facebook instructs you to substitute APP_ID for your own. You'll need an application if you want to retrieve data about that person when they login, for example
email
name
gender
location
etc...
You'll have to authenticate your users with an app_id and app_secret to retrieve an access_token. That access_token is unique per user per application. More info on authentication is here.
Basically, every time you want to query Facebook's databases, with the Graph API or FQL, you do so on behalf of the user. Facebook links these calls to applications so that they will be able to know which application has what permissions and also what they are doing with them.
Click on over to https://developers.facebook.com/apps and after you have verified your Facebook developer account you'll be able to create a new app

How to check if website is authorized by user on access his information in FaceBook Api

I am working on the FaceBook Javascript API.
I want to know if there is any way in which we can find out if a user has authorized a web site or not.
if authorized, the signed_request attribute from facebook will have a user_id in it (after decoding it with the website's oauth_secret )

Getting a user's ID using Facebook's Graph API

Is it possible to get the ID (Facebook Graph API) of a user who is currently logged in, without any access tokens?
If not, then how do I get new access tokens every time a user visits my page?
You will need to init the Facebook Javascript SDK and the user will have to have authorized your app at least one time. After that when the user visits your page as long as they are logged into Facebook you'll have access to the id and can retrieve it using
FB.getLoginStatus
the response will contain the information you're looking for.
Check this blog post for more details on setting up the FB init and the initial login.
https://developers.facebook.com/blog/post/525/
You can check the facebook ID using their username
http://graph.facebook.com/radrivan
You can use the javascript sdk to get their accesstoken and let them allow your app.
https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.2

Facebook Connect api in php

HI, I hava a website in php where i have integrated a Facebook Connect API which enabled the Facebook login button.
I login using the button by providing my Facebook credentials. It gets logged in. I can access my profile picture, full name and some other information. But i can't access the user email id i.e. the Facebook user id. I have checked the FBML page here but i didn't get any tag that may give me the user id. I guess that Facebook might not allow me to get the id.
Please help me how to get the Facebook user id from the Facabook Connect API.
Apparently, Facebook uses an numeric increment ID instead of email addresses to uniquely identify each User entity. By Facebook API policies, email addresses are protected to prevent spam and other issues.
In order for an application to get the email addresses of a Facebook User, you will need special permissions from the User. See the API for such permissions.

Getting Facebook Details

how can i get a facebook user's info like name, country, etc without making him login using fb connect, etc if i already know his facebook id?
I mean can i use the php facebook client to get those details without prompting for login if i already know the facebook id?
Thanks in advance :)
You can't get that information with just a facebook id unless the person who the information belongs to made that information public (which almost noone has).
The only solution I see is to ask your users for the extended permission "offline_access".
As far as I know you can only do this from within a facebook application or through the Facebook Connect javascript library (so not with the PHP library for instance).
This means that you will have to ask users to login at facebook through fb:connect atleast once, ask for offline access and store the facebook sessionKey in your local database.
Because you have offline access now, the facebook sessionKey won't expire and you can login serverside without the user being present.
This is how I implemented the php server side after attaining the permanent session:
$this->fb = new Facebook($settings["api_key"], $settings["secret"], false, true);
$this->fb->user = $facebookUserId;
$this->fb->api_client->session_key = $sessionKey;
$this->fb->api_client->set_user($facebookUserId);
The only other way to get a private users information is if you have an application and that user has given it access. Then you can snatch up any data using a FQL query.
$facebook->api_client->fql_query(
"SELECT first_name, last_name, location
FROM user
WHERE uid={$userid},
AND is_app_user;"
);