似乎Facebook在12月5日的新版本给我带来了一些问题.是否有其他人收到此错误?
Koala :: Facebook :: APIError(OAuthException:此授权码已被使用.)
我能够oauth,但是当我发出呼叫时,执行以下操作......我得到了错误.即以下:
@friends = graph.get_object("/me/friends")
Run Code Online (Sandbox Code Playgroud)
这是Facebook更新:
OAuth授权码的新安全限制我们只允许一次授权代码交换访问令牌,并要求在创建后的10分钟内将其交换为访问令牌.这与OAuth 2.0规范一致,从一开始就说"授权代码必须是短期和单次使用".有关更多信息,请查看我们的身份验证文档.
如果有人可以提供帮助,或者甚至更具体地说明Facebook更新的含义,那将非常有帮助.我正在使用Rails考拉宝石.
这似乎在这里报道,但没有答案有帮助.
http://developers.facebook.com/bugs/121266004701942?browse=search_50c113068fae60719135553
根据facebook,截至2014年4月30日,该create_event
方法已不再可用,我认为这意味着无法发布事件?
https://developers.facebook.com/docs/apps/changelog
create_event不再可用.
是否仍然可以使用v1.0?(将于2015年4月30日逐步淘汰).我找不到任何示例,我想代表facebook页面发布活动.这还有可能吗?
https://developers.facebook.com/docs/graph-api/reference/v1.0/page/events
当我尝试它时,我得到折旧警告和冒充使用令牌的页面,但是当我使用我的个人令牌时它也失败了.可能是因为我没有create_event权限(尽管请求它,它不会显示在facebook令牌调试器中)
Deprecation warning: The REST API is now deprecated; please use the equivalent Graph API methods instead. See http://developers.facebook.com/blog/post/616/.
=> {"error_code"=>190,
"error_msg"=>"Impersonated access tokens can only be used with the Graph API",
Run Code Online (Sandbox Code Playgroud)
权限:
[{"permission"=>"installed", "status"=>"granted"},
{"permission"=>"public_profile", "status"=>"granted"},
{"permission"=>"manage_pages", "status"=>"granted"},
{"permission"=>"publish_actions", "status"=>"granted"}]
Run Code Online (Sandbox Code Playgroud) 我在我的rails应用程序中使用koala gem来使用Facebook Open Graph API.该应用程序的主要语言是德语.
有没有办法设置一个区域设置来获得例如用户在德语中的当前城市?或者还有另一个可靠的wa来翻译位置吗?
我有一个用户可以在其上发布节目的应用程序。我想添加rsvp_events,以便用户可以在单击“前进”按钮时将其活动发布到Facebook上。我已经设置了一切,一切似乎都很好,但是当我尝试使用Koala在Facebook上发布活动时,出现以下错误,
"error": {
"message": "(#2) Service temporarily unavailable",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "H7WRzXo7d3C"
}
Run Code Online (Sandbox Code Playgroud)
}
我正在使用考拉宝石,我正在这样做,
@facebook = Koala::Facebook::API.new(oauth_token)
@facebook.put_connections("me", "namespace:go" , show: "http://samples.ogp.me/173451500015976867")
Run Code Online (Sandbox Code Playgroud)
有什么办法吗?
所以我为这些问题看起来多么荒谬而道歉.我是rails的新手,作为第一个任务,我也带来了Neo4J,因为如果我发展这个项目,它似乎是最合适的.
我将解释操作流程然后显示一些示例代码.我现在尝试在步骤3-5中添加.
因为3-5只需要在用户第一次加入时发生,我想我可以在与after_save
回调相关的方法中执行此操作.这个逻辑有一个缺陷,因为我需要在某个时候用其他属性更新用户,它会再次调用after_save.我可以通过更新来防止这种情况发生吗?
SessionsController供参考
def create
user = User.from_omniauth(env["omniauth.auth"])
session[:user_id] = user.id
redirect_to root_url
end
def destroy
session.delete(:user_id)
redirect_to root_path
end
Run Code Online (Sandbox Code Playgroud)
所以在我的user.rb中我有这样的东西
has_many :both, :friendships
after_save :check_friends
def self.from_omniauth(auth)
@user = User.where(auth.slice(:provider, :uid)).first
unless @user
@user = User.new
# assign a bunch of attributes to @user
@user.save!
end
return @user
end
def facebook
@facebook ||= Koala::Facebook::API.new(oauth_token)
block_given? ? yield(@facebook) : @facebook
rescue Koala::Facebook::APIError => e
logger.info e.to_s
nil
end
def …
Run Code Online (Sandbox Code Playgroud) 我正在使用Koala 1.7.0rc1和新的Facebook图形api面临一个问题.我正在尝试使用此请求检索帖子的数量[object_id]/likes?summary=1
.此查询适用于Facebook Graph Explorer,但我无法使用Koala访问"摘要":
likes = graph.get_object("5718732097_10151698726822098", summary: 1){|data| data['likes']}
# OR
likes = graph.get_object("5718732097_10151698726822098/likes?summary=1")
Run Code Online (Sandbox Code Playgroud) 我试图通过以下代码通过Gem Koala Facebook API获取用户信息
@graph = Koala::Facebook::API.new(auth_hash.credentials.token)
profile = @graph.get_object("me")
user.update(
url: auth_hash.extra.raw_info.id,
email: auth_hash.extra.raw_info.email,
friends: @graph.get_connections("me", "friends"),
birthday: @graph.get_object("me", "birthday")
)
friends: @graph.get_connections("me", "friends")
工作得很好,我会得到一个朋友列表.
但是birthday: @graph.get_object("me", "birthday")
会给我type: OAuthException, code: 2500, message: Unknown path components: /birthday [HTTP 400]
返回数组的东西likes
,photos
工作正常.
但是字符串如last_name
,name
,first_name
会给我同样的错误.
我该怎么做才能解决这个问题?还有其他东西我可以进入而不仅仅是birthday