如何“喜欢”当我已经有一个身份验证令牌时
我正在深入研究一个问题的本质,这个问题后来证明是相当麻烦的,所以我向你们,专家们寻求帮助。
到目前为止我所做的:我正在使用phonegap 构建一个iPhone 应用程序。我正在使用提供的 fbconnect (在phonegap github 中)代码,它提供了一些相当方便的基于 javascript 的示例代码来构建评论和签入请求等内容。我的评论和签入完全按照我想要的方式工作,并且我有一个我成功携带的 auth_token。
输入“like”按钮:我知道您不能像使用注释那样通过 xmlhttprequest 发出类似的请求,因此我只能使用 iframe(除非有更好的替代方案)。
我需要帮助:现在,由于 iframe 正在触发自己的登录,我遇到的情况是用户可能会登录喜欢,然后必须再次登录才能发表评论,这是不可行的。有没有办法将有效的身份验证令牌传递给 iframe,这样用户就不会被提示再次登录或通过我当前实现的 childbrowser 解决方案进行其他一些偷偷摸摸的方式授权,然后将身份验证令牌共享给其他人应用程序?
注意:我尚未将应用程序 ID 传递给我的身份验证实现,但我注意到 iframe 确实传递了应用程序 ID。是否会在我的身份验证请求中包含应用程序 ID 以某种方式链接登录信息,以便 Facebook 可以识别出用户已经通过应用程序登录?
我想不出要包含的任何具体代码,因为这更多是一个一般性问题,但如果您想查看任何内容,请告诉我。
I'm getting into the grimy guts of a problem that has turned out to be rather cumbersome so I turn to you, the experts, for help.
what I've done so far: I am building an iphone app with phonegap. I am using the provided fbconnect (in phonegap github) code which gives some rather convenient javascript based example code to build things like a comment and check in request. I have comments and checkins fully working how I want, and I have an auth_token that I am successfully toting around.
enter the like button: I understand that you cannot make like requests via xmlhttprequest in the same way that you can with comments for example, so I am stuck using an iframe (unless there is a better alternative).
what I need help with: right now, since the iframe is triggering its own login, I have the situation where the user might log in to like, and then have to log in again to comment which is not a viable. Is there a way to pass a valid auth token to the iframe so the user wont be prompted to log in again or some other sneaky way to authorize through the childbrowser solution that I have currently implemented and then share the auth token to the rest of the app?
notes: I havent passed an app ID to my auth implementation but I noticed that the iframe does pass an app ID. would including an app ID in my auth request somehow link the logins so facebook could recognize that the user is already logged in through the app?
I can't think of any specific code to include since this is more of a general question but if there is anything you'd like to have a look at please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答是否定的,主要是为了安全和防止垃圾邮件。让用户喜欢您的页面的唯一方法是在 Web 视图中呈现 iframe 代码。这需要使用传统的电子邮件/密码登录 Facebook。使用图形 API 是使用评论和签入等功能的唯一方法,这需要用户通过单独的机制登录,然后批准您的应用程序。没有后门登录机制。
The short answer is no, mainly for security and spam prevention. The only way to have the user like your page is rendering the iframe code in a webview. This requires a traditional email/password login with Facebook. Using the graph api is the only way to use things like commenting and checkins, and this requires a user to login via a separate mechanism and then subsequently approve your app. There is no back door logging in mechanism.