Sha256: d9386e4b06db774998a32d7e179f575f07961ceefa7be52da68cafb9ef8aa052

Contents?: true

Size: 748 Bytes

Versions: 4

Compression:

Stored size: 748 Bytes

Contents

module Devise
  module Oauth2
    class TokensController < ApplicationController

      before_action :authenticate_anyone!
      skip_before_action :verify_authenticity_token, :only => :create

      def create
        @refresh_token = oauth2_current_refresh_token || oauth2_current_client.refresh_tokens.create!(:owner => current_anything)
        @access_token = @refresh_token.access_tokens.create!(:client => oauth2_current_client, :owner => current_anything)
        render :json => @access_token.token_response
      end

      private

      def oauth2_current_client
       env[Devise::Oauth2::CLIENT_ENV_REF]
      end
      def oauth2_current_refresh_token
        env[Devise::Oauth2::REFRESH_TOKEN_ENV_REF]
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise_oauth2_rails4-2.1.8 app/controllers/devise/oauth2/tokens_controller.rb
devise_oauth2_rails4-2.1.7 app/controllers/devise/oauth2/tokens_controller.rb
devise_oauth2_rails4-2.1.6 app/controllers/devise/oauth2/tokens_controller.rb
devise_oauth2_rails4-2.1.5 app/controllers/devise/oauth2/tokens_controller.rb