Skip to content

Commit

Permalink
The client obtains an access token from the authorization server by m…
Browse files Browse the repository at this point in the history
…aking an HTTP POST request to the token endpoint (not GET).
  • Loading branch information
jeremy committed Apr 25, 2010
1 parent d67e48f commit 8466973
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/oauth2/strategy/web_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def authorize_params(options = {}) #:nodoc:
# in order to successfully verify your request for most OAuth 2.0
# endpoints.
def get_access_token(code, options = {})
response = @client.request(:get, @client.access_token_url, access_token_params(code, options))
response = @client.request(:post, @client.access_token_url, access_token_params(code, options))
params = Rack::Utils.parse_query(response)
token = params['access_token']
OAuth2::AccessToken.new(@client, token)
Expand All @@ -30,4 +30,4 @@ def access_token_params(code, options = {}) #:nodoc:
end
end
end
end
end
4 changes: 2 additions & 2 deletions spec/oauth2/strategy/web_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
cli = OAuth2::Client.new('abc','def', :site => 'http://api.example.com')
cli.connection.build do |b|
b.adapter :test do |stub|
stub.get('/oauth/access_token?code=sushi&client_id=abc&client_secret=def&type=web_server') do |env|
stub.post('/oauth/access_token?code=sushi&client_id=abc&client_secret=def&type=web_server') do |env|
[200, {}, 'a=1&access_token=salmon']
end
end
Expand Down Expand Up @@ -42,4 +42,4 @@
@access.token.should == 'salmon'
end
end
end
end

0 comments on commit 8466973

Please sign in to comment.