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

Fix strategy configuration #1

Merged
merged 1 commit into from
Jul 5, 2022
Merged

Fix strategy configuration #1

merged 1 commit into from
Jul 5, 2022

Conversation

smcabrera
Copy link
Collaborator

This omniauth strategy, like the SurveyMonkey one before it, didn't quite work out of the box. This PR contains the tweaks we needed in order to get it to work in our testing locally

Comment on lines +25 to +27
def callback_url
full_host + script_name + callback_path
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We got an error saying it was missing required parameters which is the same error we got with SurveyMonkey so we tried the same remedy and it worked

Copy link

Choose a reason for hiding this comment

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

is this overriding a method from super or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct. I can see if I can find the original explanation of it for SurveyMonkey...

Copy link
Collaborator Author

@smcabrera smcabrera Jul 1, 2022

Choose a reason for hiding this comment

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

Here's the same change we made for SurveyMonkey user-interviews/omniauth-surveymonkey-oauth2#1

Based on an identical change for the twitch gem

image

Here's the original omniauth change that broke things for a lot of gems omniauth/omniauth-oauth2#70

Copy link

Choose a reason for hiding this comment

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

twitch integration when

# Override authorize_params so that we can be deliberate about the value for state
# and not use the session which is unavailable inside of an iframe for some
# browsers (ie Safari)
def authorize_params
# Only set state if it hasn't already been set
options.authorize_params[:state] ||= SecureRandom.hex(24)
params = options.authorize_params.merge(options_for("authorize"))
options.authorize_params[:scope] = 'manage:all'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not ideal--we'd rather it have just the scopes that we need, which you should be able to do by setting them in the omniauth config...but I tried that and it didn't work. We can try to look into a better solution in the future.

Copy link

@AlexAlt AlexAlt left a comment

Choose a reason for hiding this comment

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

nice- seems like it's battle tested so lgtm

@smcabrera
Copy link
Collaborator Author

@michaeldewolf85 we looked at this together so I'm going to assume you're ok with the changes. Also since it's a dependency anyway it's inherently lower risk so I feel confident about merging it in at this point and we can make more changes if we need to

@smcabrera smcabrera merged commit c0b0eab into master Jul 5, 2022
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.

2 participants