Facebook API:允许我自己的网站访问我的个人资料,半永久 [英] Facebook API: allow my own website to access my profile, semi-permanently

查看:146
本文介绍了Facebook API:允许我自己的网站访问我的个人资料,半永久的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本质上,我想从我的Facebook个人资料中获取我的博客抢墙照片,状态更新等。我知道Javascript sdk如何工作:用户点击一个特殊的Facebook按钮,然后给我的网站权限一段时间。我正在使用它来抓住发布在我的网站上显示他们的意见旁边的人的显示图片。



然而,这是一个有点不同的用例:我将是唯一一个允许我的网站的人,这将是长期的(几星期?)。我可以轻松地将客户端身份验证流程一起自己去点击并接受,我想知道是否有更好的方式来管理这种事情?一些后门,我作为Facebook用户,可以手动授予我的网站做东西。



编辑:我浏览了我的应用权限管理页面Facebook,虽然我可以删除应用程式权限,并查看他们拥有和使用的权限,但无法手动添加更多权限

解决方案


  1. https://开发人员创建一个应用程序.facebook.com / apps

  2. 图形API资源管理器,并从该应用程序获取访问令牌。

  3. CLick获取访问令牌,并给出您认为的任何权限

  4. 接受权限

  5. 将生成的访问令牌复制/粘贴到代码中,完成



  6. 如果令牌过期(例如,您更改密码或您的帐户由于安全原因而被锁定)只需使用相同的步骤


    生成新令牌

    Essentially I want to have my blog grab wall photos, status updates, etc. from my facebook profile. I know how the Javascript sdk works: the user clicks on a special facebook button which then gives my website permissions, for some short duration. I'm using it to grab the display picture of people who post on my website to show next to their comments.

    However, this is a somewhat different use case: I'll be the only one person giving permission to my website, and it will be for the long term (weeksish?). I can easily hack together a client-side authentication flow for myself to go and click on and accept, I was wondering if there was a better way to manage this sort of thing? Some backdoor where I, as a facebook user, can manually "give permission" to my website to do stuff.

    EDIT: I looked through the app permissions management page on my facebook, and although I can remove app permissions and see what permissions they have and have been using, there is no way to add more permissions manually

    解决方案

    1. Create an app at https://developers.facebook.com/apps
    2. Choose that app in the dropdown at the top right of the Graph API Explorer and get an access token from that app.
    3. CLick 'Get access token' and give it whatever permissions you think you'll nee to access the data you want.
    4. Accept the permissions
    5. Copy/paste the generated access token into your code and you're done

    If the token ever expires (e.g. you change password or your account is locked for security reasons) just generate a new token using the same steps

    这篇关于Facebook API:允许我自己的网站访问我的个人资料,半永久的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆