AccessToken accessToken = new DefaultFacebookClient().obtainAppAccessToken("59397xxxxxxxxxx", "154001c66ih1bv3j128e2c712a54e73");
My application access token: AccessToken[accessToken=iu1h3iu1b231h2b3j1hb31jh3bjh1 expires=null]
Then I store the access token
FacebookClient facebookClient = new DefaultFacebookClient(accessToken.getAccessToken());
And then when I use it to perform an action, which is:
User user = facebookClient.fetchObject("me", User.class);
It gives me the following error:
Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: An active access token must be used to query information about the current user.
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Second time I run the app I choose the other method with the access token provided before:
AccessToken accessToken = new DefaultFacebookClient().obtainExtendedAccessToken("59397xxxxxxxxxx", "154001c66ih1bv3j128e2c712a54e73", "iu1h3iu1b231h2b3j1hb31jh3bjh1");
It immediatly throws an exception right away in the line:
Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: No user access token specified
I can only work with the Graph API Token which is only available for 2 hours!!! Can anyone help me ? I'm dying over here, done a lot of tries and couldn't come up with anything. Am I doing something wrong ?
Thanks everyone,
Francisco Gameiro
Anyone ? :)
On 19.04.2013 11:30, Carlos Esquivel wrote:
> Is it possible to get an OAuth access tokenwithout navigating to the
> Graph API Explorer app??
-> http://www.restfb.com/#initialization
"Not sure how to get an OAuth access token?
It's really easy with the Facebook Graph API. Sign in to Facebook and
navigate to the Graph API Explorer app. Click the "Get Access Token"
button. That's it!
Keep in mind that this is only useful for quick testing. For production
use, you'll need to create a Facebook Application and use it to obtain
OAuth tokens for your users. Take a look at the FB Authentication
documentation[1] for more details."
Cheers,
Marcel
[1] https://developers.facebook.com/docs/authentication/
--
Marcel St�r, http://www.frightanic.com
--
You received this message because you are subscribed to the Google Groups "RestFB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to restfb+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks & Regards,
Kumar Pallav
Analyst Programmer | Business Solution Division |Wipro Ltd.|Infopark Special Economic Zone | Kusumagiri, Kakkanadu, Kerala 682030, India|
+91- 773-663-7166