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

Rename strategy name to match devise omniauth patterns #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jkintscher
Copy link

@jkintscher jkintscher commented Nov 24, 2023

Carbon copy of #12. This should really be fixed.


This PR aims to resolve an integration issue between your gem and OmniAuth 2 within the Devise ecosystem. The current problem arises from the strategy name not being properly normalized, resulting in conflicts that skip the middleware. Additionally, there is an issue with the on_auth_path? method from the OmniAuth strategy not matching under Devise configurations. Let's delve into these points in more detail for improved clarity and readability.

The specific line in the OmniAuth gem (https://github.com/omniauth/omniauth/blob/a86acdfd7639c9e4c4dc9968d36c1eae0e9141d7/lib/omniauth/strategy.rb#LL187C7-L187C56) expects to find the authentication path that matches the name "cognito-idp".
However, the normalization methods used by Devise expect patterns from Rails routes to use underscores (_), resulting in callbacks and methods expecting "cognito_idp".
Consequently, the strategy in the middleware gets ignored because it expects the correct name.
To address this issue, the proposed solution involves renaming the strategy to match the expected methods from Devise's OmniAuth callbacks controller.

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

Successfully merging this pull request may close these issues.

1 participant