Skip to content

[1.x] Deprecate Authorization helpers in Faraday::Connection#1306

Merged
iMacTia merged 6 commits into1.xfrom
deprecate-auth-headers
Aug 14, 2021
Merged

[1.x] Deprecate Authorization helpers in Faraday::Connection#1306
iMacTia merged 6 commits into1.xfrom
deprecate-auth-headers

Conversation

@iMacTia
Copy link
Copy Markdown
Member

@iMacTia iMacTia commented Aug 14, 2021

Description

After reviewing the authorisation part of middleware, I realised we currently expose helpers in Faraday::Connection to setup the Authorization header. The implementation is quite old (I couldn't find any reference to the Token type, it seems it has been replaced by Bearer), with intra-dependencies that make the code hard to read and maintain.

I believe in v2.0 we should remove the helpers and rework the middleware, but in the meantime this PR will add a deprecation warning to the 1.x branch:

  • Deprecate auth helpers in Faraday::Connection
  • Update docs to show correct usage of the authorization middleware

@iMacTia iMacTia requested a review from olleolleolle August 14, 2021 08:11
@iMacTia iMacTia self-assigned this Aug 14, 2021
Copy link
Copy Markdown
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super deprecated!

Nice with the docs changes. Idea: promote the Authorization to first place, the others being not as recommended.

Copy link
Copy Markdown
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@iMacTia
Copy link
Copy Markdown
Member Author

iMacTia commented Aug 14, 2021

Idea: promote the Authorization to first place, the others being not as recommended

I like this suggestion, and also the introduction could use some rewording, it's much better now!

@iMacTia iMacTia requested a review from olleolleolle August 14, 2021 08:51
Copy link
Copy Markdown
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready to go, I think! 🥳

@olleolleolle olleolleolle changed the title Deprecate Authorization helpers in Faraday::Connection [1.x] Deprecate Authorization helpers in Faraday::Connection Aug 14, 2021
@iMacTia iMacTia merged commit fa612a0 into 1.x Aug 14, 2021
@iMacTia iMacTia deleted the deprecate-auth-headers branch August 14, 2021 12:30
@ybiquitous
Copy link
Copy Markdown

Hi, how about marking the deprecated methods by the YARD @deprecated tag?

@ybiquitous
Copy link
Copy Markdown

Oh, sorry. I see the methods were deleted via #1308. 😅

@olleolleolle
Copy link
Copy Markdown
Member

olleolleolle commented Aug 31, 2021

We'll keep the YARD tag in mind for the next time we make a release with a deprecation! Thanks!

@ghost
Copy link
Copy Markdown

ghost commented Sep 11, 2021

I'm getting WARNING: Faraday::Connection#authorization is deprecated; it will be removed in version 2.0. everywhere when using Ruby. Octokit. Is this the reason, and what would need to be done to fix it?

@iMacTia
Copy link
Copy Markdown
Member Author

iMacTia commented Sep 13, 2021

@theLucid it most definitely is, it appears something is calling the now deprecated authotization method on the connection. It's really easy to fix it, you just need to follow the updated doc page.

If you point me to the right place in the code where this happen, I might be able to provide further help

Drenmi added a commit to discourse/discourse that referenced this pull request Oct 15, 2025
Faraday [updated their authentication/authorization middleware in version 2](lostisland/faraday#1306), which was a breaking change for the Twitter auth health check.

The relevant test was manually mocking and stubbing the individual Faraday objects, so the relevant code path wasn't exercised by our tests.

This commit:

- Updates the test to use `stub_request` instead. (This correctly catches
the deprecated method error.)
- Updates the health check to use the new middleware.
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 this pull request may close these issues.

3 participants