Sha256: e3dfbbc574da2262d7baad6a2b309829278000238149d875f569ec4c351e417d
Contents?: true
Size: 531 Bytes
Versions: 102
Compression:
Stored size: 531 Bytes
Contents
require 'faraday' require_relative 'token' require_relative '../globals' module Spaceship class TokenRefreshMiddleware < Faraday::Middleware def initialize(app, token) @token = token super(app) end def call(env) if @token.expired? puts("App Store Connect API token expired at #{@token.expiration}... refreshing") if Spaceship::Globals.verbose? @token.refresh! end env.request_headers["Authorization"] = "Bearer #{@token.text}" @app.call(env) end end end
Version data entries
102 entries across 102 versions & 4 rubygems