lib/flattr/oauth2.rb in flattr-0.2.1 vs lib/flattr/oauth2.rb in flattr-0.2.2
- old
+ new
@@ -1,9 +1,9 @@
module Flattr
module OAuth2
- def authorize_path(opts = {})
+ def authorize_url(opts = {})
default_options = {
:client_id => client_id,
:client_secret => client_secret,
:response_type => "code"
@@ -23,10 +23,19 @@
"#{authorize_endpoint}/?#{query_string}"
end
def get_access_token(code)
- post(token_endpoint, {:code => code, :grant_type => 'authorization_code'}, options)
+ response = post(token_endpoint, {
+ :code => code,
+ :grant_type => 'authorization_code'
+ },{
+ :headers => {
+ :authorization => "Basic #{base64_encode("#{client_id}:#{client_secret}")}"
+ }}
+ )
+ self.access_token = response['access_token']
+ access_token
end
end
end