diff --git a/lib/omniauth/strategies/base_strategy.rb b/lib/omniauth/strategies/base_strategy.rb index 2ca2896..f75af63 100644 --- a/lib/omniauth/strategies/base_strategy.rb +++ b/lib/omniauth/strategies/base_strategy.rb @@ -7,6 +7,7 @@ module OmniAuth module Strategies class BaseStrategy < OmniAuth::Strategies::OpenIDConnect class APIError < StandardError; end + class ClientCredentialsError < StandardError; end def public_key @public_key ||= if options.discovery @@ -18,6 +19,14 @@ def public_key end end + def client + super + rescue AttrRequired::AttrMissing + raise ClientCredentialsError.new( + "#{options[:name].camelize} client credentials not found. Please check your environment." + ) + end + def self.decode_logout_token(token) jwks = fetch_jwks JSON::JWT.decode(token, jwks)