Skip to content

Commit

Permalink
Made the OAuth 2 redirect_uri param in the options hash mandatory and…
Browse files Browse the repository at this point in the history
… created a method to get it.
  • Loading branch information
Ruben Homs committed Mar 19, 2013
1 parent 6ac2213 commit ce2536a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/oauth/controllers/consumer_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def show

unless @token
if @consumer.ancestors.include?(Oauth2Token)
request_url = callback2_oauth_consumer_url(params[:id]) + callback2_querystring
request_url = callback2_oauth_consumer_url + callback2_querystring
redirect_to @consumer.authorize_url(request_url)
else
request_url = callback_oauth_consumer_url(params[:id]) + callback2_querystring
Expand All @@ -45,7 +45,7 @@ def callback2_querystring
end

def callback2
@token = @consumer.access_token(current_user,params[:code], callback2_oauth_consumer_url(params[:id]))
@token = @consumer.access_token(current_user,params[:code], callback2_oauth_consumer_url)
logger.info @token.inspect
if @token
# Log user in
Expand Down Expand Up @@ -118,6 +118,10 @@ def destroy
end
end

def callback2_oauth_consumer_url
@consumer.consumer.options[:redirect_uri]
end

protected

# Override this in your controller to decide where you want to redirect user to after callback is finished.
Expand Down

0 comments on commit ce2536a

Please sign in to comment.