Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - OAuthException - I keep getting: "An active access token must be used to query information about the current user"

I've used this exact code and others that work to a certain degree, but I keep getting the following error:

{"error":{"type":"OAuthException","message":"An active access token must be used to query information about the current user."}}

Here is the code: I've used the access_token I get back and validated it against plugging it into my browser and it works great. But this code seems to either not be using the access token I get back, or I'm not setting it. I've even tried the FB.setAccessToken() method as well as params.putString("access_token", MY_ACCESS_TOKEN).

I'm wondering, since I did not need to change the access token for the website url to work, I would not think that I don't need to do anything special to the access_token like ecoding it like in a url?

Thanks for your help. I've scoured the net for answers for hours and there seems to not be any.

Bundle params = new Bundle();

params.putString("message", "Test");
params.putString("name", "American Virgin");
params.putString("link", "http://bit.ly/12345");
params.putString("description", "A Freshman College Girl on a scholarship from an ...");
params.putString("picture", "http://xxx/MOV1026.jpg");

mAsyncRunner.request("me/feed", params, "POST", new TestRequestListener());
like image 442
Maxx57 Avatar asked Feb 11 '11 09:02

Maxx57


1 Answers

Did you try to include the below code?

@Override  
protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
        mFacebook.authorizeCallback(requestCode, resultCode, data);  
}  

According to the documentation, this must be included or the authentication will not function properly, which in turn could cause the error you're encountering. I had the same problem but then realized I was missing this.

like image 84
mojothemonkey Avatar answered Oct 11 '22 17:10

mojothemonkey