Sha256: 7e296c781a38f18bf22c44beb06761bd3ad69a361c5bd63abf99cea171f7e5e4
Contents?: true
Size: 933 Bytes
Versions: 2
Compression:
Stored size: 933 Bytes
Contents
# Monkeypatching to work with how Active Passport names the access token on a successful response module OAuth2 # The OAuth2::Client class class Client # Initializes an AccessToken by making a request to the token endpoint def get_token(params, access_token_opts={}) params = Authenticator.new(id, secret, options[:auth_scheme]).apply(params) opts = {:raise_errors => true, :parse => params.delete(:parse)} if options[:token_method] == :post opts[:body] = params opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'} else opts[:params] = params end response = request(options[:token_method], token_url, opts) raise Error.new(response) unless response.parsed.is_a?(Hash) && (response.parsed['access_token'] || response.parsed['accessToken']) AccessToken.from_hash(self, response.parsed.merge(access_token_opts)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omniauth-active-passport-0.0.2.1 | lib/oauth2_patch/client.rb |
omniauth-active-passport-0.0.2 | lib/oauth2_patch/client.rb |