Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make the Netflix OAuth API use my callback?
    text
    copied!<p>I have a simple Rails application with which I am trying to use the Netflix API to gain access to some of my subscriber information, such as my history and queue. My problem is that no matter what I do, Netflix will not use my <code>oauth_callback</code> url, but instead forwards me to the Netflix site after I authorize the application with my user credentials.</p> <p>Here is the controller code which is making the request to the Netflix API</p> <pre><code>class ExportController &lt; ApplicationController def export consumer = OAuth::Consumer.new( ENV['NETFLIX_KEY'],ENV['NETFLIX_SECRET'], :site =&gt; "http://api.netflix.com", :request_token_url =&gt; "http://api.netflix.com/oauth/request_token", :access_token_url =&gt; "http://api.netflix.com/oauth/access_token", :authorize_url =&gt; "https://api-user.netflix.com/oauth/login" ) request_token = consumer.get_request_token session[:request_token]=request_token session[:request_token_secret]=request_token.secret url = request_token.authorize_url( :oauth_callback =&gt; "http://#{ENV['OAUTH_CALLBACK_DOMAIN']}/export_callback/", :oauth_consumer_key =&gt; ENV['NETFLIX_KEY'], :application_name =&gt; ENV['APPLICATION_NAME'] ) redirect_to url end def export_callback @request_token=OAuth::RequestToken.new(session[:request_token],session[:request_token_secret]) @access_token = @request_token.get_access_token(:oauth_verifier =&gt; params[:oauth_verifier]) end end </code></pre> <p>The controller correctly redirects to <code>https://api-user.netflix.com/oauth/login</code> site, with all the parameters correctly set. I get the Netflix Login/Authorize app page.</p> <p><img src="https://i.stack.imgur.com/oOVDv.png" alt="Netflix Link Account page"></p> <p>However, if I look at the source of this page, I see in the form that the <code>oauth_callback</code> field is set to <code>oob</code></p> <pre><code> &lt;input type="hidden" name="oauth_callback" value="oob"/&gt; </code></pre> <p>I've checked several different ways, and I am setting the <code>oauth_callback</code> parameter just the same as the <a href="http://developer.netflix.com/walkthrough" rel="nofollow noreferrer">Netflix Authentication Walkthrough</a>. In fact, when I go through the walkthrough and put in my callback url in their field, it does in fact redirect back to my rails application.</p> <p>So, my question, does anyone know how to make Netflix respect my <code>oauth_callback</code> field?</p> <p>edit:</p> <pre><code>https://api-user.netflix.com/oauth/login?oauth_callback=http%3A%2F%2Fnetflix.dev%2Fexport_callback%2F&amp;oauth_consumer_key=[REMOVED]&amp;oauth_nonce=631831&amp;oauth_timestamp=1321458391&amp;application_name=[REMOVED]&amp;oauth_token=[REMOVED] </code></pre> <p>You can see <code>oauth_callback=http%3A%2F%2Fnetflix.dev%2Fexport_callback%2F</code> being set, which is the route to my local rails app.</p> <p>edit2:</p> <p>I am using the <code>oauth (0.4.5)</code> and <code>rails (3.1.0)</code> and <code>ruby-1.9.2-p290 [ x86_64 ]</code> on Mac OS X 10.6.8.</p>
 

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