Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
474 views
in Technique[技术] by (71.8m points)

facebook - Access "Public" Graph API resources from an app?

I am creating a web application that is trying to use "public" Facebook content.

It is not your traditional "Facebook Application" because I'm not actually signing up Facebook users to use it, but the users will be all server-side.

I've come to a point in which I am having to use an "access_token" for certain "public" pieces of content and I have been able to generate a app access_token but this does not work for the public data I'm interested in accessing.

access_token's created via

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

do not work for

https://graph.facebook.com/chickfila/notes?access_token=CODE_FROM_ABOVE

which is publicly accessable w/o login here...

http://www.facebook.com/ChickfilA?sk=notes

Any way to give an app itself a user-level access_token?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had a very similar problem with publicly available event data. What I had to do was to create an offline access token for the admin of the application.

So, log in with your admin and open the following URL (replace APP ID with your ID and eventually you need more permissions, but read_stream and offline_access should do the trick):

https://graph.facebook.com/oauth/authorize?client_id=APPID&scope=offline_access,read_stream&redirect_uri=http://www.facebook.com/connect/login_success.html

This will give you a code, that you will paste in the following URL (with your APP ID and SECRET):

https://graph.facebook.com/oauth/access_token?client_id=APPID&redirect_uri=http://www.facebook.com/connect/login_success.html&client_secret=SECRET&code=CODE

This will give you an access token that should work forever (or until you change your password).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...