class OmniAuth::Etencent::AccessToken

Public Class Methods

from_hash(client, hash) click to toggle source
Calls superclass method
# File lib/omniauth-etencent/access_token.rb, line 5
def from_hash(client, hash)
  return unless hash && hash['code'] == 0 && hash.dig('data', 'access_token')

  data = hash['data'].merge('expires_in' => hash.dig('data', 'access_token_expires_in'))
  data['refresh_token_expires_at'] ||= Time.now.to_i + data['refresh_token_expires_in'].to_i if data['refresh_token_expires_in'].to_i > 0
  super(client, data)
end