Class: Oauth2::AuthenticationController
- Inherits:
-
Oauth2Controller
- Object
- Oauth2Controller
- Oauth2::AuthenticationController
- Defined in:
- app/controllers/oauth2/authentication_controller.rb
Instance Method Summary collapse
Instance Method Details
#access_token ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/controllers/oauth2/authentication_controller.rb', line 23 def access_token token = Oauth2Token.find!(params) render({ :text => {:access_token => token.token}.to_uri, :content_type => 'application/x-www-form-urlencoded', :status => :ok }) end |
#authorize ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/oauth2/authentication_controller.rb', line 13 def args = params.slice(:client_id, :redirect_url) args[:user_id] = current_user.uuid token = Oauth2Token.create!(args) uri_params = {:code => token.code} uri_params[:state] = params[:state] if params.has_key?(:state) uri = params[:redirect_url].with_params(uri_params) redirect_to(uri) end |