Difficulty parsing string with Facebook one click sign on and ColdFusion

[亡魂溺海] 提交于 2019-12-23 03:51:50

问题


I am using using ColdFusion 9.0.1

I am building a site that will use Facebook connections extensively, so we need the Facebook one click sign on. Specifically, to vote on our site, visitors will just "log in with Facebook" and can do all sorts of cools things while we track what they do using their email address.

I am only slightly confused by the Facebook documentation. And with their recent security change, most of the tutorials and help files I find elsewhere are out of date. So....

I have the single click sign on form on my page. When I am logged out of Facebook, I can use the "log into Facebook" link on my site to log in to my site as well as Facebook. So, I know the form works and the cookie works too.

From what I understand, I am supposed to read the cookie that Facebook sets in the browser and then parse it to access the info I need. Here's the cookie for my site:

cookie.fbsr_252075631496861

When I CFDUMP this cookie, here's what I get:

 P2Hlk0UVT2EXc8LiaH48vmL_gI7Y4mwkto0IoSUN9mI.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiIyLkFRQ0VLMC1ibzhqeVhJSzYuMzYwMC4xMzI0MzM5MjAwLjEtMTAwMDAwNTg3NDM1OTY1fFNrYkQ1NU9UWndFMTh3cGE4TUZLZkpLalZzdyIsImlzc3VlZF9hdCI6MTMyNDMzNTU2OCwidXNlcl9pZCI6IjEwMDAwMDU4NzQzNTk2NSJ9

I have found a few tutorials on how to parse this string, but nothing works. I don't really know if I am acessing the right cookie.

Now that the user is logged into my site via Facebook, I just need their FBID to access their info. I believe the FBID is buried in this cryptic string.

Can you provide any help?


回答1:


Once you get parsed signed_request (stored in your cookie) you can use user_id (which is Facebook User Id) and oauth_token (aka access_token) to get needed info via Graph API or FQL.



来源:https://stackoverflow.com/questions/8568825/difficulty-parsing-string-with-facebook-one-click-sign-on-and-coldfusion

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