Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:40:57+00:00 2026-06-08T14:40:57+00:00

I made a few Facebook apps with the SDK a while ago, but now

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:40:59+00:00Added an answer on June 8, 2026 at 2:40 pm

    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:

    1. Get a token (from somewhere)
    2. Talk to Facebook and get the UserID associated with that token
    3. Update token (if looking for long access tokens)
    4. Store token (if you want to remember it for later)
    5. Do something with the UserID, validating the calls with the token.

    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:

    • in a session variable ($_SESSION) which will persist while the PHP sessions is active
    • in a cookie ($_COOKIE) which will persist while the cookie is valid
    • by passing between webpages as a $_GET or $_POST variable
    • in a database – BUT you must have another SessionID under our own control (passed in $_SESSION, $_COOKIE, $_GET or $_POST) or another way of getting hold of the right token.

    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:

    1. You have another session system that is controlling your application (especially third party apps where you don’t want to mess with their interal session system, so add your own wrapper on top)
    2. You want to do something when the user is no present (e.g. post to wall after a comment is approved in your own moderator system). In this case, you need the token to approve the post, but as the user is not there, you don’t have access to $_COOKIE or $_SESSION etc.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a similar question a few days ago, but now I have new
I made a few Polygons on a Google map. Now I want to add
Ive made a few posts regarding jqgrid now and am getting the slowly but
I have made multiple simple but fun apps for iPhone in the past few
I've made a few commits and now I want them (say from some commit
I made few checkboxes using swing in Java. I want to write a superscript
im working with a cms made a few years ago in asp/vbscript (old asp)
I'm using TortoiseSVN. I just made quite a few changes to my working copy
I am not a seasoned SSRS veteran. I have made quite a few but
A few years ago i made am webbapp with ajax and php, i really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.