-
Notifications
You must be signed in to change notification settings - Fork 699
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 omniauth strategy not being set correctly for apps using session tokens #1164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of the overrides here, but let's mark follow-up work to see if we can refactor the *_session_by_cookie
methods to behave differently under different contexts
801ce71
to
a8c0d6c
Compare
This is to limit the blast radius of our changes. |
a8c0d6c
to
dd7fe28
Compare
dd7fe28
to
66a879e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cce7e51
to
a50cf7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a50cf7f
to
48f3ed1
Compare
48f3ed1
to
9cf97a4
Compare
What is the issue?
Currently, new apps using
shopify_app
have session tokens enabled and cookies based auth disabled by default. The problem is that even at the top level actions where cookies are accessible and appropriate to use,LoginProtection
gates it's usage inuser_session_by_cookie
andshop_session_by_cookie
using theallow_cookie_authentication
setting. This has led to calls for theuser_session
andshop_session
resulting innil
, leading the app to falsely believe that it doesn't have an offline and/or online token.OAuth redirect loops for offline tokens
session[:user_tokens]
to true asshop_session
check returnsnil
OAuth redirect loops for online tokens
user_session
results innil
What is the fix?
SessionsController
andCallbackController
can both operate from the top-level. Use of session cookies are justified in these scenarios.OAuth redirect loops for offline tokens
Override the
shop_session_by_cookie
method inSessionsController
to ensure we are still using session cookies as before on the top level.OAuth redirect loops for online tokens
Override the
user_session_by_cookie
method inCallbackController
to ensure we are still using session cookies as before on the top level.🎩
Before
Screen.Recording.2021-01-26.at.4.30.31.PM.mov
After
Screen.Recording.2021-01-26.at.4.22.26.PM.mov
Before submitting the PR, please consider if any of the following are needed:
CHANGELOG.md
if the changes would impact usersREADME.md
, if appropriate.docs/
, if necessary