Faraday::Error: :basic_auth is not registered on Faraday::Request
rgaufman opened this issue · 5 comments
Basic Info
- Faraday Version: 2.2.0
- Ruby Version: 3.0.3p157
Steps to reproduce
I'm following the documentation and if I understand correctly, this should be correct:
connection = Faraday::Connection.new do |conn|
conn.adapter Faraday.default_adapter
end
connection.request :basic_auth, 'test', 'test'
However it throws this exception:
Faraday::Error: :basic_auth is not registered on Faraday::Request
from /opt/homebrew/lib/ruby/gems/3.0.0/gems/faraday-2.2.0/lib/faraday/middleware_registry.rb:57:in `lookup_middleware'
Any ideas? - this started since upgrading the faraday gem.
Ah, it seems this changed between version 1 to 2, but I can't find any documentation how to achieve basic_auth and digest_auth in version 2? - can somebody please point me to some documentation?
@rgaufman Hi! #1405 this Issue notes that work is underway to improve the situation.
This section in the UPGRADING document may have a lead for you:
https://github.com/lostisland/faraday/blob/b2390ec2b3f35c2d9a1010527b139aefc85fcede/UPGRADING.md#authentication-helper-methods-in-connection-have-been-removed
Thank you, that mentions basic auth but any solution for digest auth?
I believe you located the gem which could assist with that. Making it compatible with 2.0 can take some doing, but it's probably possible.
I added a PR to have CI running for that gem, and I hope that that can get the ball rolling again.
https://github.com/bhaberer/faraday-digestauth is the other gem, which currently seems not to have an active maintainer: perhaps they would like a hand with that.
The issue registered in this Issue's title has been dealt with, and I will close this Issue.