RailsCasts Pro episodes are now free!

Learn more or hide this

blackbumer's Profile

GitHub User: blackbumer

Comments by blackbumer

Avatar

Since oauth2 1.1.0 with CSRF protection this code doesn't work. Could somebody point right direction how to apply state param in this provider and client example. thanks

Avatar

Hi,
i'm trying to extend this example with json response
in session controller

def create
auth = request.env["omniauth.auth"]
user = User.where(:provider => auth['provider'],
:uid => auth['uid']).first || User.create_with_omniauth(auth)
session[:user_id] = user.id
respond_to do |format|
format.html { redirect_to root_url, :notice => 'Signed in!'}
format.json { render :json => user }
end
end

Started POST "/auth/identity/callback.json"
i got error 500

NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]):
app/controllers/sessions_controller.rb:10:in `create'

coresponding with this code in the session create controller

user = User.where(:provider => auth['provider'], 
                  :uid => auth['uid']).first || User.create_with_omniauth(auth)

How to add json response in this schema?
i need able authorize to my site via mobile app

Avatar

how to define mimetypes right in case of dynamic generating js and css (not only html )

Started GET "/" for 192.168.1.4 at 2011-02-19 13:26:13 +0300
  Processing by WelcomeController#carousel as HTML
Rendered welcome/carousel.mobile.erb within layouts/application (47.3ms)
Completed 200 OK in 54ms (Views: 52.9ms | ActiveRecord: 0.0ms)

Started GET "/netzke/touch.css" for 192.168.1.4 at 2011-02-19 13:26:14 +0300
  Processing by NetzkeController#touch as CSS
Completed 406 Not Acceptable in 1ms

Started GET "/netzke/touch.js" for 192.168.1.4 at 2011-02-19 13:26:14 +0300
  Processing by NetzkeController#touch as JS
Completed 406 Not Acceptable in 1ms

i got 406 error on other types!