intridea/omniauth — Issue #528: Support for Facebook Javascript SDK
Author: davidkariuki
Created: 2011-11-01 22:20:00+00:00
State: open

I'm trying to integrate omniauth with the Facebook Javascript SDK as follows:

```coffeescript
$('#facebookLogin').live 'click', ->
FB.login ((response) ->
if response.authResponse
window.location = "/users/auth/facebook/callback?code=" + response.authResponse.accessToken
else
console.log "User cancelled login or did not fully authorize."
),
scope: "email, offline_access"

false
```

but this gives me an `Invalid verification code` error:

```
#:post, :body=>"{\"error\":{\"message\":\"Invalid verification code format.\",\"type\":\"OAuthException\"}}", :url=>#, :request_headers=>{"Content-Type"=>"application/x-www-form-urlencoded"}, :parallel_manager=>nil, :request=>{:proxy=>nil}, :ssl=>{}, :status=>400, :response_headers=>{"access-control-allow-origin"=>"*", "cache-control"=>"no-store", "content-type"=>"text/javascript; charset=UTF-8", "expires"=>"Sat, 01 Jan 2000 00:00:00 GMT", "pragma"=>"no-cache", "www-authenticate"=>"OAuth \"Facebook Platform\" \"invalid_code\" \"Invalid verification code format.\"", "x-fb-rev"=>"465729", "x-fb-server"=>"10.32.52.112", "connection"=>"close", "date"=>"Tue, 01 Nov 2011 22:14:45 GMT", "content-length"=>"81"}, :response=>#}, @on_complete_callbacks=[]>, @options={:parse=>:query}, @error=#, @parsed={"{\"error\":{\"message\":\"Invalid verification code format.\",\"type\":\"OAuthException\"}}"=>nil}>

```