I have a website that uses facebook connect to allow users to login to the site's login system. If I want to verify that the facebook user id's captured by our database match those who are authorized by facebook to our application by facebook and vice-versa, how would I do that?
For example, if I log in the facebook developer application and it tells me that we have 7 users (I assume this means 7 people who have "connected" to our application), where would I find a list of those 7 users.
I assume their facebook user id's are public information, yet I would like a way to obtain them in a list pertaining to our application.
I assume that this is common for the purposes of database maintenance (and in my case just to verify that everything is working properly).
Looks to me based on the dev console that you can't get a list like this. The best you can do is get friend.getAppUsers() which gives you a list of your friends that have the app installed. Bummer; I actually really need this too for an application I'm working on. I guess just use the post-authorize, deauthorize callback urls to manage the list of users on your end.
I missed first lot of application users too.
Then I start to add username and ID to database as soon as they visit the first page of application after authorizing the application.
Now anybody new comes to my application they are added to 'appusers' table
Related
I have been maintaining a site that allows users to login using the FB credentials. For the last 2 years this has all been working fine on our servers, still works fine actually.
Now I have added a new integration server. When a user logs in with their FB credentials a different ID is returned, different from the ID they get when they log into our older servers.
When i use either ID in facebook.com i get sent to the proper home page. So it looks like a user has more than one FB ID.
Has anyone seen this before? I am stumped. Have copied the working Facebook app definitions for the older servers, no joy. Stripped down the app definition for the new server, no joy.
One difference is that our new server is using an IP address, not a dns entry. Could that be the problem?
thanks for any help.
With the introduction of API v2.0, Facebook has made user ids app-scoped – meaning, each app will see a different app-scoped id for a user. Purpose is of course to improve user privacy.
https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api
And before you ask: No, you can not get the “real” id from an app-scoped one – and you’re not supposed to.
If you need to identify users across different apps owned by your company, see what it says about the Business Mapping API (litte bit further down in the changelog.)
I have a well functioning login system right now. Im in the process of implementing Google+ and Facebook login too. Its works fine. But:
When a user logs in via Facebook or Google shall I create a new user in my web apps users database? If so, what should i fill as password?
Lets say a user has logged in via Facebook and he inserts a new book in the books table. What shall I put in the creator column of the inserted row? Usually I put the user id of the logged in user which has a row in the users table.
A user doesnt have an account on my web app. He signs in for the first time using Google+. What happens to that user if he later on chooses to remove my site from his connected accounts on google? This might be related to the first question.
Thank you.
The Documentation of the both API are really great and understandable. But I could find answers to my questions.
It's technically possible to use Google+ Sign-In without data persistence. As an example, you can see client-side-only Google+ Sign-In features on the Is Too Cute demo site.
There are certain benefits to adding data persistence and managing your own set of users but there is still a ton of great functionality you can get without needing to implement a data store:
Over-the-air Android installs
Interactive Posts
Personalize the site to the user
Access Google APIs while the user is actively browsing your site.
I am working on a web based project that allows a user to login using a Facebook login. This part works as expected. However after logging in I want to display non-FB specific content specific to each user. How can I do this efficiently? For testing suppose I want to display a different greeting for each FB user and display a different background after successful login using FB username. Any sample code to play with would be highly appreciated.
I guess it's pretty late to answer yet I would like to. I assume you want to differentiate between the greeting, for example, that gets generated for a core user (one signed up manually through form) and a user logged in using facebook, right? Well, you can store the facebook id of each user and then it would be easy for you to generate messages respectively!
Let's say I own/control a Facebook page where events are posted. I'd like to display these events on another website (In my case, a WordPress blog, but that's not the important part) on an "Upcoming events" page.
What I'm unsure about is: Is the Facebook API usable "externally" like this? I've downloaded the PHP library and have a demo app running that works from within Facebook (i.e. emitting FBML that facebook.com interprets and displays to the logged-in user), but in my case I want a third party (my web server) to query Facebook every so often, rather than the site visitors directly requesting data (HTML/JSON/etc.) from Facebook itself.
Is this sort of thing possible with the Facebook API? How will my web server authenticate itself? What information do I have to store?
Note: I'm looking for information more at a "sequence diagram" conceptual level, not just asking for code. That part I can figure out myself. ;) Unfortunately, Google and the FB developer wiki have not been entirely forthcoming. What do I need to know so I can start coding?
This is a basic overview of how I've done it for a few of my clients who wanted similar functionality:
Create a pretty basic app that prompts for Extended permissions, specifically "offline_access" and whatever else you need
Store the resulting Session Key in your database with the UID
Create a secure, authenticated webservice for your app which allows you to get the info you need for a UID that you supply, using the session that you've stored in your database
On the website make requests to your app's webservice, being sure to cache the results for a certain period of time and only make a new request to your webservice once the cache has expired (I use 5-10 minutes for most of mine)
So basically your Facebook app acts sort of like a proxy between the website and the user, doing all of the authenticating and requesting using legitimate means.
I've used a webservice because I only wanted to maintain one Facebook app for multiple client's needs. It works like this (in a not-very-awesome ASCII art diagram):
Facebook User 1 \ / Client Website 1
Facebook User 2 --- Facebook App --- Client Website 2
Facebook User 3 / \ Client Website 3
Note: I've only done this for users, not pages, so your mileage may vary.
You can do Events.get with the Facebook API then supply the page/profile ID you'd like to get the events for. Depending on how your page is setup you may have to authenticate, simply use your Facebook account, since you should have access to all the events. oh and make sure you do plenty of caching so your not hitting Facebook on every page load.
AFAIK other than user info, you can't fetch any other data from facebook.
But you can try it other way - say create an app that stores events and other relevant information on a webserver and then your other website can easily access that info.
I'm developing a website using Facebook Connect as the only membership/authentication mechanism.
So far authentication and inviting friends work.
Now I'd like to display a list of users registered with my Facebook application. Something like : "There are 1234 members in the AppName community" + a list of profile pictures.
How would I do that ?
Thanks !
This is actually pretty easy to do. After each user connects with your site through Facebook Connect, create an entry for them in some user table (which you're probably already doing). Then when a user logs in simply display the total number from your users table and randomly select 10 user IDs (or whatever number of pictures you want to display) and show them using the FBML <fb:profile_pic> tag http://wiki.developers.facebook.com/index.php/Fb:profile-pic.
There is some metric information available about your application via the Admin.getMetrics API call. I believe it only provides the number of active users within a certain time period however.
The actual total number of users is difficult to track due to people who remove the application, or might have it installed but blocked. I don't think it's available as a specific property anywhere. The information pages about Facebook apps never show the total number of users, only the monthly active users, which is what Admin.getMetrics() can tell you.