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 9071695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:58:34+00:00 2026-06-16T17:58:34+00:00

I have developed an app so that users can upload images to a page’s

  • 0

I have developed an app so that users can upload images to a page’s album. I do not want users to have to authorize and so I used the access token from the app to upload the images for them. This works fine if the admin is logged in and the access token hasn’t expired – it only seems to last for a couple hours. I have looked through stackoverflow and facebook and tried many different things and nothing seems to work. Here is some of the code I am using:

try {
        $facebook->setAccessToken("APP_ACCESS_TOKEN_FROM_GRAPH_API_TOOL");
        $token_url="https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=fb_exchange_token&fb_exchange_token=".$facebook->getAccessToken();
        $page_id = 'PAGE_ID';
        $response = file_get_contents($token_url);
        $params = null;
        parse_str($response, $params);
        $page_info['access_token'] = $params['access_token'];
        $page_info = $facebook->api("/".$page_id."?fields=access_token");
        if( !empty($page_info['access_token']) ) {
            $photo_details['access_token'] = $page_info['access_token'];
            $upload_photo = $facebook->api('/'.$page_id.'/photos', 'post', $photo_details);

Am I dreaming? Is this possible and I just screwed up the code? Any help would be much appreciated even just to point me in the right direction…

  • 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-16T17:58:35+00:00Added an answer on June 16, 2026 at 5:58 pm

    Currently, your code uses your own Access Token, not the App Access token.

    To get the app access token, you need to make a get request to https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials as documented at https://developers.facebook.com/docs/technical-guides/opengraph/publishing-with-app-token/

    in your implementation, and assuming that APP_SECRET and APP_ID are defined as constants, you’d get the app access token through :

    $appAccessToken = str_replace("access_token=","",$facebook->api("https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials"));
    $facebook->setAccessToken($appAccessToken);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a small web app. This app allows users to upload images.
I've developed an app that allows users to upload some photos and share them
i have developed an app that can download mp3 files (nearly 6 to 8
I have developed a windows phone app that sends notification to users. There is
I have developed an app that in testing has worked fine but when it
I have developed a C# app that overrides the PreviewMouseUp, PreviewMouseMove, and PreviewMouseDown events
I have a nice clean domain layer in my app that was developed in
I have an app that I want to develop for Android 2.1, 2.2, 2.3.3,
I have developed an android app that sends sms. My problem is that when
I want to allow users of an iPhone app to upload photos and use

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.