Update oauth models and controllers for OAuth 1.0a support

This commit is contained in:
Tom Hughes 2010-09-10 10:31:44 +01:00
parent c08f9a2f03
commit 1c3a9ee62b
5 changed files with 67 additions and 8 deletions

View file

@ -52,9 +52,17 @@ class OauthController < ApplicationController
if any_auth
@token.authorize!(@user)
redirect_url = params[:oauth_callback] || @token.client_application.callback_url
if @token.oauth10?
redirect_url = params[:oauth_callback] || @token.client_application.callback_url
else
redirect_url = @token.oob? ? @token.client_application.callback_url : @token.callback_url
end
if redirect_url
redirect_to "#{redirect_url}?oauth_token=#{@token.token}"
if @token.oauth10?
redirect_to "#{redirect_url}?oauth_token=#{@token.token}"
else
redirect_to "#{redirect_url}?oauth_token=#{@token.token}&oauth_verifier=#{@token.verifier}"
end
else
render :action => "authorize_success"
end