2

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.