diff --git a/lib/spotify/accounts.rb b/lib/spotify/accounts.rb index 998edb0..85986db 100644 --- a/lib/spotify/accounts.rb +++ b/lib/spotify/accounts.rb @@ -115,7 +115,7 @@ def authorize_url(override_params={}) # def exchange_for_session(code) validate_credentials! - Spotify::Accounts::Session.from_authorization_code(code) + Spotify::Accounts::Session.from_authorization_code(self, code) end def inspect # :nodoc: diff --git a/lib/spotify/accounts/session.rb b/lib/spotify/accounts/session.rb index 8f00b21..59a4078 100644 --- a/lib/spotify/accounts/session.rb +++ b/lib/spotify/accounts/session.rb @@ -11,7 +11,7 @@ class << self # Parse the response we collect from the authorization code. # # @example - # @session = Spotify::Accounts.from_authorization_code(@accounts, "authorization code here") + # @session = Spotify::Accounts.from_authorization_code(accounts, "authorization code here") # # @param [Spotify::Accounts] accounts A valid instance of Spotify::Accounts. # @param [String] code The code provided in the Redirect URI from the Spotify Accounts API. @@ -20,9 +20,9 @@ class << self # def from_authorization_code(accounts, code) params = { - client_id: @accounts.instance_variable_get(:@client_id), - client_secret: @accounts.instance_variable_get(:@client_secret), - redirect_uri: @accounts.instance_variable_get(:@redirect_uri), + client_id: accounts.instance_variable_get(:@client_id), + client_secret: accounts.instance_variable_get(:@client_secret), + redirect_uri: accounts.instance_variable_get(:@redirect_uri), grant_type: "authorization_code", code: code }