設計/ omniauth成立,現在我想使用Facebook的JavaScript SDK登錄/索要權限,然後它們路由到我omniauth回調控制器。如何從Facebook獲取授權碼我的JavaScript SDK
這是我(的CoffeeScript)。
$('#fb-connect').live 'click', ->
FB.login ((response) ->
if response.authResponse
window.location = "https://stackoverflow.com/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
這個我覺得是隻對omniauth 0.3.2,後來真(在時間我在0.3.0) – CodeWombat