mgomes / api_auth

HMAC authentication for Rails and HTTP Clients
MIT License
480 stars 147 forks source link

Write a middleware for Faraday #208

Closed fmang closed 2 years ago

fmang commented 2 years ago

Unlike other HTTP client libraries, Faraday does not expose request objets too easily. Instead, it provides a framework for configuring connections. Authorization in Faraday is meant to be handled through the use of middlewares.

By convention, Faraday middlewares are defined under the Faraday namespace, even when they’re not official. Like other middlewares, requiring faraday/api_auth registers the middleware into Faraday with a name. Since that side effect depends on the presence of Faraday, it cannot be part of ApiAuth directly.

The previously-existing Faraday integration still exists for whoever managed to use it, though I suggest deprecating it.

fmang commented 2 years ago

I’ve fixed all the issues with the CI but this one, which is unrelated to this pull request:

api_auth.gemspec:38:3: C: [Correctable] Gemspec/DeprecatedAttributeAssignment: Do not set test_files in gemspec.
fwininger commented 2 years ago

thanks for the contribution @fmang