omniauth-oauth icon indicating copy to clipboard operation
omniauth-oauth copied to clipboard

Add support for Rack 3.x and fix compatibility issues.

Open adifsgaid opened this issue 1 year ago • 0 comments
trafficstars

Add support for Rack 3.x and fix compatibility issues

Issue Reference

This PR addresses the issue described in omniauth Issue 1135, where OmniAuth 2.1.2 encounters errors when used with Rack 3.1.7, specifically during the Twitter OAuth callback phase.

Description

When using OmniAuth 2.1.2 with Rack 3.1.7, an error occurs during the Twitter OAuth callback phase. This error suggests an incompatibility between OmniAuth and Rack 3.x versions. The callback fails with a NoMethodError, indicating that the [] method is undefined for the Rack::Request instance.

This pull request aims to resolve these compatibility issues and ensure that the OmniAuth-OAuth gem works seamlessly with both Rack 2.x and Rack 3.x versions.

Changes Made

  1. Updated the gemspec to include Rack as a dependency, allowing for versions from 1.6.2 up to (but not including) 4.0:

    gem.add_dependency "rack", ">= 1.6.2", "< 4"
    
  2. Modified the callback_phase method to be compatible with both Rack 2.x and 3.x request handling

  3. Updated the test suite to include specific tests for Rack 2.x and 3.x compatibility

  4. Bumped the gem version from 1.2.0 to 1.2.1 to reflect these changes.

Compatibility Notes

This update addresses the breaking changes introduced in Rack 3.x, particularly:

Testing

The updated test suite includes scenarios for both Rack 2.x and 3.x environments. All tests pass successfully, ensuring compatibility across different Rack versions.

Affected Components

  • OmniAuth::Strategies::OAuth
  • Test suite for OmniAuth-OAuth

Additional Context

While investigating this issue, we found that other OmniAuth providers (Facebook, GitHub, Google, etc.) were not affected. This suggests that the problem may be specific to how the OmniAuth-OAuth gem interacts with Rack, rather than a general OmniAuth issue.

Your review and feedback are greatly appreciated. Let me know if any further changes or information are needed. @BobbyMcWho

adifsgaid avatar Jul 26 '24 08:07 adifsgaid