Class: LHS::Interceptors::AutoOauth::Interceptor
- Inherits:
-
LHC::Interceptor
- Object
- LHC::Interceptor
- LHS::Interceptors::AutoOauth::Interceptor
- Defined in:
- lib/lhs/interceptors/auto_oauth/interceptor.rb
Instance Method Summary collapse
Instance Method Details
#before_request ⇒ Object
12 13 14 |
# File 'lib/lhs/interceptors/auto_oauth/interceptor.rb', line 12 def before_request request.[:auth] ||= { bearer: token } end |
#token ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lhs/interceptors/auto_oauth/interceptor.rb', line 20 def token if tokens.is_a?(Hash) tokens.dig( request.[:oauth] || request.[:record]&.auto_oauth ) else tokens end end |
#tokens ⇒ Object
16 17 18 |
# File 'lib/lhs/interceptors/auto_oauth/interceptor.rb', line 16 def tokens @tokens ||= LHS::Interceptors::AutoOauth::ThreadRegistry.access_token end |