class FmRest::Cloud::AuthErrorHandler
Public Class Methods
new(app, settings)
click to toggle source
Calls superclass method
# File lib/fmrest/cloud/auth_error_handler.rb, line 6 def initialize(app, settings) super(app) @settings = settings end
Public Instance Methods
call(env)
click to toggle source
# File lib/fmrest/cloud/auth_error_handler.rb, line 11 def call(env) request_body = env[:body] # After failure env[:body] is set to the response body @app.call(env) rescue APIError::AccountError => e ClarisIdTokenManager.new(@settings).expire_token # Faraday::Request::Authorization will not get a new token if the # Authorization header is already set env.request_headers.delete("Authorization") env[:body] = request_body @app.call(env) end