Sha256: 4d416b5c7b1d618d11c48f69c3da095e009e39894016e3b0c428cc07f5140792
Contents?: true
Size: 767 Bytes
Versions: 8
Compression:
Stored size: 767 Bytes
Contents
module Feed2Gram class RefreshesToken def refresh!(config, options) return unless config.access_token_refreshed_at.nil? || config.access_token_refreshed_at < Time.now - (60 * 60) puts "Refreshing Facebook OAuth token" if options.verbose data = Http.get("/oauth/access_token", { grant_type: "fb_exchange_token", client_id: config.facebook_app_id, client_secret: config.facebook_app_secret, fb_exchange_token: config.access_token }) config.access_token = data[:access_token] config.access_token_refreshed_at = Time.now.utc puts "Updating Facebook OAuth token in: #{options.config_path}" if options.verbose File.write(options.config_path, config.as_yaml) end end end
Version data entries
8 entries across 8 versions & 1 rubygems