【发布时间】:2011-10-26 00:00:06
【问题描述】:
我已经设置了设计/omniauth,现在我想使用 Facebook javascript SDK 登录/请求权限,然后将它们路由到我的omniauth 回调控制器。
这就是我所拥有的(coffeescript)。
$('#fb-connect').live 'click', ->
FB.login ((response) ->
if response.authResponse
window.location = "/users/auth/facebook/callback?code=" + response.authResponse.signedRequest
else
console.log "User cancelled login or did not fully authorize."
), scope: "email, offline_access"
false
但我收到了 Invalid verification code format 错误。我假设这是因为代码参数需要签名请求以外的东西?
更新
所以看起来我需要传递授权码,但我找不到方法。 direct url example 表明您可以指定 response_type=code 来获取授权码,但我不知道如何使用 FB.api 来做到这一点。有什么想法吗?
http://www.facebook.com/dialog/oauth/?
scope=email,user_birthday&
client_id=123050457758183&
redirect_uri=http://www.example.com/response&
response_type=code
【问题讨论】:
标签: javascript ruby-on-rails-3 facebook devise omniauth