Reputation: 1908
I managed to get authorization working following this tutorial and oauth-plugin: http://unhandledexpression.com/2011/06/02/rails-and-oauth-plugin-part-1-the-provider/
However, in a mobile app context, I'm stuck in how to make both authorization and authentication (with Devise) in one step - since the user already logged in to get the oauth access token.
class ApiController < ApplicationController
before_filter :oauth_required
def current_user=(user)
current_user = user
end
def show_current_user
puts current_user ### nil
end
end
Any ideas?
Upvotes: 2
Views: 529
Reputation: 465
So your question is, why current_user is nil? Or do you have a question like the following? OAuth2 Provider: How to offer a login page in order to let oauth clients get the resource owner id
Instead of before_filter you should use the (yet undocumented) oauthenticate method.
class ApiController < ApplicationController
oauthenticate
end
Upvotes: 1