lib/httpx/plugins/oauth.rb in httpx-1.2.1 vs lib/httpx/plugins/oauth.rb in httpx-1.2.2
- old
+ new
@@ -58,19 +58,20 @@
def token_endpoint
@token_endpoint || "#{@issuer}/token"
end
def load(http)
- return unless @token_endpoint && @token_endpoint_auth_method && @grant_type && @scope
+ return if @token_endpoint_auth_method && @grant_type && @scope
- metadata = http.get("#{issuer}/.well-known/oauth-authorization-server").raise_for_status.json
+ metadata = http.get("#{@issuer}/.well-known/oauth-authorization-server").raise_for_status.json
@token_endpoint = metadata["token_endpoint"]
@scope = metadata["scopes_supported"]
@grant_type = Array(metadata["grant_types_supported"]).find { |gr| SUPPORTED_GRANT_TYPES.include?(gr) }
@token_endpoint_auth_method = Array(metadata["token_endpoint_auth_methods_supported"]).find do |am|
SUPPORTED_AUTH_METHODS.include?(am)
end
+ nil
end
def merge(other)
obj = dup