module Baidu::OAuth::Flow::Tokenable

@private

Public Instance Methods

get_token(code, redirect_uri=nil, params={}) click to toggle source

Sub class must implement token_body method

# File lib/baidu/oauth/flow/base.rb, line 41
def get_token(code, redirect_uri=nil, params={})
  body = token_body.update params
  body.update({ client_id: self.client.client_id,
                client_secret: self.client.client_secret,
                redirect_uri: redirect_uri, code: code})
  rest = self.client.post Baidu::OAuth::TOKEN_ENDPOINT, nil, body
  return nil if rest.nil?
  Baidu::Session.from rest
end