Getting App Access Token for facebook app?

懵懂的女人 提交于 2019-12-04 18:09:08

问题


I have read this: trying to get app access token

And it doesn't work... I'm getting the following error:

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

I need the app access token in order to create open graph objects that are owned by the application. I know how to create objects owned by the users, but I just cant find the correct way of creating the App access token.

AppId -> doesn't work... AppId|AppSecret -> doesn't work.... App ClientToken -> doesn't work....

Anyone know this?


回答1:


You can get it directly from the Access Token Tool.


Please note: For security, app access token should never be hard-coded into client-side code, doing so would give everyone who loaded your webpage or decompiled your app full access to your app secret, and therefore the ability to modify your app. This implies that most of the time, you will be using app access tokens only in server to server calls.




回答2:


It looks like you have a valid token, you're just trying to query for the current user. If you're using the app token, however, there isn't a current user, so it's failing.




回答3:


If you are using Java language to fetch app access token, you can try this:

DefaultFacebookClient facebookClient = new DefaultFacebookClient(Version.LATEST);
AccessToken accessToken = facebookClient.obtainAppAccessToken(clientId, clientSecret);
System.out.println(accessToken);

To check whether it is valid, use access token debugger.



来源:https://stackoverflow.com/questions/18046255/getting-app-access-token-for-facebook-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!