Dhinakaran Thennarasu
Dhinakaran Thennarasu

Reputation: 3356

Get access token; Unknown path components: /access_token, (works in graph API explorer,)

Code from Graph API Explorer

accesstoken = AccessToken.getCurrentAccessToken();

However I am confused , I am requesting for accesstoken. still i should accesstoken as a field?

How do I get a accesstoken. I do not intend to fb login a user to get a session via login.

I just want to get a page posts and display them.

If i use accesstoken = AccessToken.getCurrentAccessToken(); I get response as Unknown path components: /access_token,

Upvotes: 3

Views: 2759

Answers (3)

Aykut Akıncı
Aykut Akıncı

Reputation: 1302

I have seen this because of wrong version formatting in the URL.
I'm trying with cURL, but this might be helpful to some people.

curl -i -X GET "https://graph.facebook.com/18/oauth/access_token?grant_type=fb_exchange_token&client_id=*&client_secret=*&fb_exchange_token=*" 

whereas this doesn't

curl -i -X GET "https://graph.facebook.com/v18.0/oauth/access_token?grant_type=fb_exchange_token&client_id=*&client_secret=*&fb_exchange_token=*"

Upvotes: 0

Onregs
Onregs

Reputation: 430

Try just oauth/access_token, for me fork without 1-st "/".

Upvotes: 0

PirateApp
PirateApp

Reputation: 6240

I would need to see your code. To access any sort of data, you would need to login and get an access token from Facebook since all the information received through the Graph API is based on the user profile and preferences. Have you configured your app by doing the following things?

  1. Create an app id on Facebook
  2. Generate a hash key
  3. Add the hash key to your app here
  4. Configure the custom Application class to include Facebook SDK initialisation code.
  5. Add the meta data to your AndroidManifest.xml containing your app id.
  6. Setup the CallbackManager and FacebookCallback with the LoginManager to perform the actual login. All the steps mentioned above are covered in full detail here Let me know how it goes

Upvotes: 1

Related Questions