Sha256: 2058842dc08cfaeeda1b6445394bacbe341b1da27b4fd4612da3e7703e97bfe8

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

class Devise::Oauth2Providable::TokensController < ApplicationController
  before_filter :clear_session
  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 clear_session
    session.clear
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anjlab-devise-oauth2-providable-1.1.3 app/controllers/devise/oauth2_providable/tokens_controller.rb