samedi 22 août 2015

url parameters are not in params

I want to get information from the TwitchTV OAuth API, and the authorization works well, but I can not get the code that Twitch redirects me to.

For example: http://localhost/?code=noj4n39487fn29fn23v92hr293hnru23v97hre&scope=

This is how Twitch redirects back to my page. In the log of my rails server it also shows the following:
Started GET "/?code=q5yptiyx3cdaep52b7xyqgt3vjpwhg&scope=" for 371.1721.13.179     at 2015-08-22 17:09:26 +0200
Cannot render console from 315.127.134.179! Allowed networks: 127.0.0.1, ::1,     127.0.0.0/127.255.255.255
Processing by HomeController#index as HTML
  Parameters: {"code"=>"q5ypti345ferf2rf2efr2erferfe23ff", "scope"=>""}
  News Load (0.6ms)  SELECT "news".* FROM "news"
  Rendered home/index.html.erb within layouts/home (14.7ms)
Completed 200 OK in 124ms (Views: 120.6ms | ActiveRecord: 1.0ms)

But when I try to get params.inspect in the controller, it shows this: {"controller"=>"oauth", "action"=>"index"} my controller looks like this:

class OauthController < ApplicationController
    def index
        redirect_to 'http://ift.tt/1Lp1k6t'
        logger.info params.inspect
    end
end

Obviously I changed all the ip's, auth-codes and stuff. My question is, shouldn't params return the parameters since it shows them as parameters (in the first code block) ?

Aucun commentaire:

Enregistrer un commentaire