简体   繁体   中英

RoR - How to obtain an access token for the facebook user using OAuth?

i want create something like "link_to" which can link to "request for permission" in facebook, so if user click "allow" then redirect to my site and i can get their data.

my question is how to create a "link" like that? so i can get access token from facebook user. (i had register my app)

thx..

It's quite simple. Just redirect the user to the Facebook Auth Page:

https://graph.facebook.com/oauth/authorize?
    client_id=...&
    redirect_uri=http://www.example.com/callback&
    scope=user_photos,user_videos,publish_stream

There're several optional parameters you can pass to get the required site.

For further Information just read the corresponding paragraph on the Facebook Documentation ("Authenticating Users in a Web Application"):

http://developers.facebook.com/docs/authentication/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM