Sha256: 76e4a483cd458cb0645970a89773458221019d7544e9a8ed0b784aac2d3530bf

Contents?: true

Size: 625 Bytes

Versions: 1

Compression:

Stored size: 625 Bytes

Contents

class Devise::Oauth2Providable::TokensController < ApplicationController
  before_filter :authenticate_user!
  skip_before_filter :verify_authenticity_token, :only => :create

  def create
    @refresh_token = oauth2_current_refresh_token || oauth2_current_client.refresh_tokens.create!(:user => current_user)
    @access_token = @refresh_token.access_tokens.create!(:client => oauth2_current_client, :user => current_user)
    render :json => @access_token.token_response
  end
  private
  def oauth2_current_client
   env['oauth2.client'] 
  end
  def oauth2_current_refresh_token
    env['oauth2.refresh_token']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_oauth2_providable-1.0.0 app/controllers/devise/oauth2_providable/tokens_controller.rb