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

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 )

Related

Twitter API OAuth session expires, Facebook's doesn't

I use the Twitter Anywhere API and OAuth to authenticate users on my website. The cookie with the accessToken expires after two hours, which is why the user needs to login and connect to Twitter regularly. The workaround would probably be to store the auth_token in a cookie and provide it the next time the user loads the page after the cookie set by twitter expired.
Now something that is not clear to me: I'm also providing Facebook as an authentification method and somehow it doesn't forget the login. The Facebook JS API doesn't store any cookies on my page, so how does it know that the user is authenticated with Facebook and my application?
are you talking about this? see the channel file portion.
EDIT: Above link has been changed. And, facebook api has changed too.
The Facebook JS API doesn't store any cookies on my page, so how does it know that the user is authenticated with Facebook and my application?
It makes a cross-domain request to facebook.com, to see if there are cookies under that domain that indicate there is a user currently logged into Facebook in some other browser window/tab.
Once it has figured out that a) there is a logged in user and b) this user has used your app before – it logs him in to your app on the fly and gives you a fresh (short-lived) user access token to work with.

How to get the logged in user's facebook ID?

I am using facebook connect to allow users to log-in to my site using facebook. I am using the server side authentication using OAuth in classic ASP, vbscript. I want to know if one of the following is possible:
1) Can I identify if the user has authorized my app without redirecting to the Auth dialog? ie, even before the user clicks the facebook login button to log-in to my site, is there a way I can find out if the user who is currently logged into facebook has authorized my app?
2) How can I get the facebook user Id of the user who is currently logged into facebook? This is outside the facebook authentication process. Does facebook offer some api which I can use to read the fb cookie that is set when a user logs into facebook and get the logged-in users's facebook user id?
Thanks
1) Use FB.getLoginStatus from the JavaScript SDK.
2) If he’s not connected to your app yet, then not at all. Otherwise, see 1)

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

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

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

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.