diff --git a/lib/googleauth/user_authorizer.rb b/lib/googleauth/user_authorizer.rb index e6948d5..ccd24d9 100644 --- a/lib/googleauth/user_authorizer.rb +++ b/lib/googleauth/user_authorizer.rb @@ -55,21 +55,25 @@ class UserAuthorizer # Authorization scope to request # @param [Google::Auth::Stores::TokenStore] token_store # Backing storage for persisting user credentials - # @param [String] callback_uri + # @param [String] legacy_callback_uri # URL (either absolute or relative) of the auth callback. - # Defaults to '/oauth2callback' + # Defaults to '/oauth2callback'. + # @deprecated This field is deprecated. Instead, use the keyword + # argument callback_uri. # @param [String] code_verifier # Random string of 43-128 chars used to verify the key exchange using # PKCE. def initialize client_id, scope, token_store, - callback_uri = nil, code_verifier: nil + legacy_callback_uri = nil, + callback_uri: nil, + code_verifier: nil raise NIL_CLIENT_ID_ERROR if client_id.nil? raise NIL_SCOPE_ERROR if scope.nil? @client_id = client_id @scope = Array(scope) @token_store = token_store - @callback_uri = callback_uri || "/oauth2callback" + @callback_uri = legacy_callback_uri || callback_uri || "/oauth2callback" @code_verifier = code_verifier end diff --git a/lib/googleauth/web_user_authorizer.rb b/lib/googleauth/web_user_authorizer.rb index ddf9644..75183c3 100644 --- a/lib/googleauth/web_user_authorizer.rb +++ b/lib/googleauth/web_user_authorizer.rb @@ -93,15 +93,22 @@ def self.handle_auth_callback_deferred request # Authorization scope to request # @param [Google::Auth::Stores::TokenStore] token_store # Backing storage for persisting user credentials - # @param [String] callback_uri + # @param [String] legacy_callback_uri # URL (either absolute or relative) of the auth callback. Defaults - # to '/oauth2callback' + # to '/oauth2callback'. + # @deprecated This field is deprecated. Instead, use the keyword + # argument callback_uri. # @param [String] code_verifier # Random string of 43-128 chars used to verify the key exchange using # PKCE. def initialize client_id, scope, token_store, - callback_uri = nil, code_verifier: nil - super client_id, scope, token_store, callback_uri, code_verifier: code_verifier + legacy_callback_uri = nil, + callback_uri: nil, + code_verifier: nil + super client_id, scope, token_store, + legacy_callback_uri, + code_verifier: code_verifier, + callback_uri: callback_uri end # Handle the result of the oauth callback. Exchanges the authorization diff --git a/spec/googleauth/user_authorizer_spec.rb b/spec/googleauth/user_authorizer_spec.rb index 2a176ae..9fb3157 100644 --- a/spec/googleauth/user_authorizer_spec.rb +++ b/spec/googleauth/user_authorizer_spec.rb @@ -85,7 +85,7 @@ Google::Auth::UserAuthorizer.new(client_id, scope, token_store, - callback_uri) + callback_uri: callback_uri) end let :uri do authorizer.get_authorization_url login_hint: "user1", state: "mystate"