Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong documentation about Authentication Middleware #1314

Closed
AlexWayfer opened this issue Aug 20, 2021 · 5 comments · Fixed by #1320
Closed

Wrong documentation about Authentication Middleware #1314

AlexWayfer opened this issue Aug 20, 2021 · 5 comments · Fixed by #1320

Comments

@AlexWayfer
Copy link
Contributor

Basic Info

  * faraday (1.7.0)
  * faraday-em_http (1.0.0)
  * faraday-em_synchrony (1.0.0)
  * faraday-excon (1.1.0)
  * faraday-httpclient (1.0.1)
  * faraday-net_http (1.0.1)
  * faraday-net_http_persistent (1.2.0)
  * faraday-patron (1.0.0)
  * faraday-rack (1.0.0)
  * faraday_middleware (1.1.0)

Ruby Version: 2.7.4

Issue description

I use authentication middleware as described in documentation and getting error.

Steps to reproduce

Documentation: https://lostisland.github.io/faraday/middleware/authentication

2021-08-20_18-10

Code:

faraday.request :authorization, :basic, config['shop_id'], config['secret_key']

Error:

ArgumentError:
       wrong number of arguments (given 4, expected 3)
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/request/authorization.rb:43:in `initialize'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/dependency_loader.rb:21:in `new'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/dependency_loader.rb:21:in `new'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:57:in `build'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:175:in `block in to_app'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:174:in `each'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:174:in `inject'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:174:in `to_app'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:167:in `app'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/rack_builder.rb:154:in `build_response'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/connection.rb:496:in `run_request'
     # /home/alex/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-1.7.0/lib/faraday/connection.rb:281:in `post'
@olleolleolle
Copy link
Member

The documentation refers to the upcoming 2.0.

Speculation: #1308 removed the code you are probably interested in using, but that code remains in the version you should have.

@AlexWayfer
Copy link
Contributor Author

The documentation refers to the upcoming 2.0.

There is no a note about this, also copyright until 2020.

Speculation: #1308 removed the code you are probably interested in using, but that code remains in the version you should have.

Thank you.

@olleolleolle
Copy link
Member

I appreciate it can be difficult to find the marker about the "upcoming version" note. We put one of these in the README: https://github.com/lostisland/faraday#attention

@iMacTia
Copy link
Member

iMacTia commented Aug 20, 2021

Thank you @olleolleolle for jumping in and clarifying.
I wonder how complicated it would be to have the documentation on the website versioned as well, with the possibility to switch between versions with a dropdown 👀. That's something we currently don't support so only the latest version (master) will be available on the site

@tibbon
Copy link

tibbon commented Aug 24, 2021

This burned about 30 minutes for me as well, looking at the docs, looking at my error, looking at the source - and wondering why none of these were lining up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants