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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:42:05+00:00 2026-05-27T01:42:05+00:00

I have a requirement where I want to use Facebookaccess token using only APIs.

  • 0

I have a requirement where I want to use Facebookaccess token using only APIs.
I have seen methods which works using web requests and responses to get the Facebook API and they also use redirect URIs.

But I cant really use redirect URI since I want to use it in a azure worker role.

Something like:

facebook a=new facebook();
a.appid="";

This is just a visualization but any help would be great.

EDIT:

Below answer helps.
and if i use following uri in browser
https://graph.facebook.com/oauth/access_token?client_id=app_Id&client_secret=secret_key&grant_type=client_credentials

it shows access_token=###
but if use following code to do the same in .net
string url = “https://graph.facebook.com/oauth/access_token?client_id=app_id
&client_secret=secretKey
&grant_type=client_credentials”;

string token;
WebRequest request = WebRequest.Create(url);
WebResponse response = request.GetResponse();

it throws unauthorized

  • 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-05-27T01:42:06+00:00Added an answer on May 27, 2026 at 1:42 am

    If the C# API doesn’t provide method for it, you can do it yourself. The access token is the content of following url. You just have to make https request.

    https://graph.facebook.com/oauth/access_token?client_id=<APP_ID>&client_secret=<APP_SECRET>&grant_type=client_credentials
    

    OK, so here is working PHP code:

    function getAccessToken(){
        $token_url = 'https://graph.facebook.com/oauth/access_token?client_id='.APP_ID.'&client_secret='.APP_SECRET.'&grant_type=client_credentials';
        return makeRequest($token_url);
    }
    
    function makeRequest( $url, $timeout = 5 ) {
        $ch = curl_init();
        curl_setopt( $ch, CURLOPT_USERAGENT, "PHP_APP" );
        curl_setopt( $ch, CURLOPT_URL, $url );
        curl_setopt( $ch, CURLOPT_ENCODING, "" );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
        curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );    # required for https urls
        curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
        curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
        curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
        $content = curl_exec( $ch );
        $response = curl_getinfo( $ch );
        curl_close ( $ch );
    
        if($response['http_code'] == 200) return $content;
        return FALSE;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what should be a fairly simple requirement. I want to use LINQ
I want to use the entity framework. However I also have the requirement of
I'm using Entity Framework 4.1 and have a seemingly simple requirement: I want to
I have a requirement: I want to call method every day at any particular
I have a requirement that I want to check the request headers and according
I have a requirement that i want to get all the system services running
I have a requirement in sharepoint where I want to Create the top link
My requirement is that I want an object (tee) to update if there have
Here's my requirement: 1. I want my installable to have a custom license agreement
I have requirement of specifying web part connections in onet.xml. So when site is

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.