Note that there are some explanatory texts on larger screens.

plurals
  1. POHeroku's Facebook Canvas app tutorial: oath error
    primarykey
    data
    text
    <p>I'm copy and pasting the code from Heroku's tutorial about building a canvas app to host on Heroku seen here. <a href="https://devcenter.heroku.com/articles/facebook-ruby" rel="nofollow">https://devcenter.heroku.com/articles/facebook-ruby</a> However, I'm getting this error which the backtrace (see below) says is related to omniauth. </p> <p>Can anyone explain</p> <pre><code>NoMethodError at / undefined method `include?' for nil:NilClass file: builder.rb location: call line: 29 </code></pre> <p>These are the gems it uses</p> <pre><code>gem 'sinatra', '1.0' gem 'oa-oauth', '0.1.6' BACKTRACE (condense) JUMP TO: GET POST COOKIES ENV /Users/michael/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/oa-core-0.1.6/lib/omniauth/builder.rb in call @ins &lt;&lt; @app unless @ins.include?(@app) /Users/michael/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb in call status, headers, body = @app.call(env) /Users/michael/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/rack-protection-1.2.0/lib/rack/protection/base.rb in call result or app.call(env) /Users/michael/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/rack-protection-1.2.0/lib/rack/protection/base.rb in call result or app.call(env) /Users/michael/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb in call </code></pre> <p><strong>Main code</strong></p> <p>index.erb</p> <pre><code>&lt;%=session['fb_error']%&gt; &lt;% if session['fb_auth'] %&gt; &lt;a href='logout'&gt;&lt;img src='images/fb_logout_button.png'&gt;&lt;/a&gt; &lt;% else %&gt; &lt;a href='auth/facebook'&gt;&lt;img src='images/fb_login_button.png'&gt;&lt;/a&gt; &lt;% end %&gt; &lt;h3&gt;&lt;%= 'Hello, ' + session['fb_auth']['user_info']['first_name'] + ', ' if session['fb_token'] %&gt;Welcome to my list of interesting articles.&lt;/h3&gt; &lt;table&gt; &lt;% @articles.each do |article| %&gt; &lt;tr&gt; &lt;td class='article'&gt;- &lt;a href='&lt;%=article[:url]%&gt;' target='_blank'&gt;&lt;%=article[:title]%&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt; &lt;% if session['fb_auth'] %&gt; &lt;iframe src="http://www.facebook.com/plugins/like.php?href=&lt;%=article[:url]%&gt;&amp;amp;layout=button_count&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light&amp;amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"&gt;&lt;/iframe&gt; &lt;% end %&gt; &lt;/td&gt; &lt;/tr&gt; &lt;% end %&gt; &lt;/table&gt; &lt;% if session['fb_auth'] %&gt; &lt;hr /&gt; &lt;p&gt;&lt;span class='like_site'&gt;Do you like this site?&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffaceboku.heroku.com%2F&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light&amp;amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre> <p>Faceboku.rb</p> <pre><code>equire 'sinatra' require 'omniauth/oauth' enable :sessions #Here you have to put your own Application ID and Secret APP_ID = "495940167082961" APP_SECRET = "686da25c0fdd04a6f61b287bb0d5c9aa" use OmniAuth::Builder do provider :facebook, APP_ID, APP_SECRET, { :scope =&gt; 'email, status_update, publish_stream' } end get '/' do @articles = [] @articles &lt;&lt; {:title =&gt; 'Deploying Rack-based apps in Heroku', :url =&gt; 'http://docs.heroku.com/rack'} @articles &lt;&lt; {:title =&gt; 'Learn Ruby in twenty minutes', :url =&gt; 'http://www.ruby-lang.org/en/documentation/quickstart/'} erb :index end get '/auth/facebook/callback' do session['fb_auth'] = request.env['omniauth.auth'] session['fb_token'] = session['fb_auth']['credentials']['token'] session['fb_error'] = nil redirect '/' end get '/auth/failure' do clear_session session['fb_error'] = 'In order to use this site you must allow us access to your Facebook data&lt;br /&gt;' redirect '/' end get '/logout' do clear_session redirect '/' end def clear_session session['fb_auth'] = nil session['fb_token'] = nil session['fb_error'] = nil end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload