Skip to content

Commit 2466989

Browse files
author
Damian Aberbuj
committed
431/fix post json for token in v1.4
1 parent d41fb6e commit 2466989

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/oauth2/client.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ def get_token(params, access_token_opts = {}, extract_access_token = options[:ex
166166
opts = {:raise_errors => options[:raise_errors], :parse => params.delete(:parse)}
167167
headers = params.delete(:headers) || {}
168168
if options[:token_method] == :post
169-
opts[:body] = params
169+
opts[:body] = if headers['Content-Type'] == 'application/json'
170+
params.to_json
171+
else
172+
params
173+
end
170174
opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'}
171175
else
172176
opts[:params] = params

0 commit comments

Comments
 (0)