class Vhx::Middleware::OAuth2
Public Class Methods
new(app, options={})
click to toggle source
Calls superclass method
# File lib/vhx/middleware/oauth2.rb, line 16 def initialize(app, options={}) super(app) @vhx_client = options[:vhx_client] end
Public Instance Methods
call(env)
click to toggle source
# File lib/vhx/middleware/oauth2.rb, line 4 def call(env) orig_env = env.dup begin @app.call(env) rescue InvalidTokenError @vhx_client.refresh_access_token! orig_env[:request_headers].merge!(@vhx_client.configured_headers) @app.call(orig_env) end end