I made a few Facebook apps with the SDK a while ago, but now I want to try making one without using the SDK. I’m confused as to how access tokens work.
I think Facebook’s PHP SDK stores the access token in a cookie, but most people on SO seem to store it in a database. Where should I store the access token?
If I store it in a database, do I store the user’s ID in a cookie then?
This is verging on a discussion question, as the answer depends on what you want to do with it.
Just a quick reminder of the process:
The token is facebooks “SessionID”. So long as you have a hold of the token, you can find the user that owned the token (if the token is still valid). You can keep hold of that token in the same way as you would a regular SessionID if you wrote your own session handler:
So, for run of the mill stuff, store in either session or cookie, depending on which suits your site better. It’s simplest.
You’d only go to the complexity of storing in a DB for two purposes:
Hope that helps.