Oauth 单击时间线中的OpenGraph链接无法通过“验证”;验证验证码时出错“;

Oauth 单击时间线中的OpenGraph链接无法通过“验证”;验证验证码时出错“;,oauth,facebook-opengraph,facebook-authentication,facebook-oauth,facebook-timeline,Oauth,Facebook Opengraph,Facebook Authentication,Facebook Oauth,Facebook Timeline,我正在尝试验证通过单击facebook上的opengraph操作访问我的网站的用户 我已经使用以下代码成功地生成了操作。这 成功转到我的时间表。到目前为止,一切顺利 require 'cgi' client_id ="CLIENT_ID" client_secret = "CLIENT_SECRET" recipe = "http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice" access_token = "

我正在尝试验证通过单击facebook上的opengraph操作访问我的网站的用户

我已经使用以下代码成功地生成了操作。这 成功转到我的时间表。到目前为止,一切顺利

require 'cgi'

client_id ="CLIENT_ID"
client_secret = "CLIENT_SECRET"

recipe = "http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice"
access_token = "LONGACCESSTOKEN"

# PUBLISH
result = `curl -F access_token=#{access_token} -F recipe=#{recipe} https://graph.facebook.com/me/foodonthetable_mrh:plan_to_cook`
puts result
当我点击时间线中的链接时,我被带到下面的URL。这就是 我开始有问题了。基本上,我想识别进来的用户 通过此链接登录(或创建新用户)。我有 已验证的推荐已打开,并且我正在接收
code
参数作为 预料之中

http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice?fb_action_ids=384156608318085&fb_action_types=foodonthetable_mrh%3Aplan_to_cook&fb_source=timeline_og&action_object_map=%7B%22384156608318085%22%3A10151004406923956%7D&code=AQAPExNw7MHkxcLTEi5L24iD79pVa-WYxyhBA_bhdWLCM0PCGDuPjh1WqmAyd3_O3_LSjYzPawrinHNP3nv9BCMB_XuTnr8De8xQ2AwXqCaeHUzZUPm2MPyQ_eodOC9-YtjkvXm_PzRX3JG58khalT3AJjVuZvKHn5hWGDSohXLRbHGxW-vOg_Whm3mt_WUkdd0#_=_
但是,当我尝试使用此代码获取
auth_令牌时,我无法。
我尝试过使用两种不同版本的
redirect\u uri
thinking 这可能是问题所在(基于其他帖子),但似乎没有任何效果

redirect_uri = "http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice"
redirect_uri = "http://foodonthetable.shadr.us/facebook_connect/connect"

code = "AQAPExNw7MHkxcLTEi5L24iD79pVa-WYxyhBA_bhdWLCM0PCGDuPjh1WqmAyd3_O3_LSjYzPawrinHNP3nv9BCMB_XuTnr8De8xQ2AwXqCaeHUzZUPm2MPyQ_eodOC9-YtjkvXm_PzRX3JG58khalT3AJjVuZvKHn5hWGDSohXLRbHGxW-vOg_Whm3mt_WUkdd0"

result = `curl -F client_id=#{client_id} -F redirect_uri=#{redirect_uri} -F client_secret=#{client_secret} -F code=#{code} https://graph.facebook.com/oauth/access_token`
puts result
无论我在这里做什么,我总是会得到以下错误:

{"error":{"message":"Error validating verification code.","type":"OAuthException","code":100}}
任何帮助都将不胜感激。

这确实解决了问题

redirect_uri = request.url.split('&code=').first

试图自我回答,但我没有足够的分数。下面是为我解决这个问题的小技巧:
redirect_uri=request.url.split('&code=')。首先