fancy
fancy

Reputation: 51383

Grokking client-side Facebook connect?

I have client-side FB connect working. In my example you just click login with Facebook and then a popup appears, they login and then are returned to the app, where I display their name and pic.

My questions are around how to make use of this connection.

Any help figuring out how this works would be spectacular. Thanks very much for the help!

Upvotes: 2

Views: 161

Answers (1)

ceejayoz
ceejayoz

Reputation: 180014

If they are using fb to log in would I create an account with this information the first time? Then supplement this info with app specific stuff? Then grab that account every time they login? How should I reference the existing account?

Yes, and you'd use their Facebook ID to find if they have an existing account.

Can I only query the API for data from the client, or can I store some info on the server that lets me query their account from the server?

Store the access token. If you need long-lasting access (the default token expires after an hour or two) you need to request offline_access extended permissions.

How would something like finding out if two people are friends work? Would this be done on the server? What does the query look like?

Fetch a user's friends list from https://graph.facebook.com/me/friends and see if the friend's Facebook ID is in there.

How long do sessions last and how is it decided? Will the login persist across multiple visits?

When the user authorizes your app via OAuth, the expiration time in seconds is appended to the URL.

Can I make use of the login when the user isn't currently active in the app? Query for a status or make a request on their account in between visits?

Yes, until the token expires. See above regarding offline_access.

Upvotes: 2

Related Questions