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

Move ownership for session persistence from library to this gem #1563

Merged
merged 17 commits into from
Dec 7, 2022

Conversation

nelsonwittwer
Copy link
Contributor

@nelsonwittwer nelsonwittwer commented Nov 2, 2022

What this PR does

Exploring the idea of moving session persistence calls to this gem instead of passing ShopifyApp::SessionRepository to the API library and having the API library be responsible for persisting the session. Having the API library invoke Rails' persistence is backward from a responsibility perspective.

The goal with this proposal is to use the API library that already returns a session payload to the shopify_app and use that payload to persist and load session data using the ShopifyApp::SessionRepository exclusively and remove any concept of session persistence from the API library.

TODO

  • Should we copy session storage errors from API library over?
  • Should we keep session ID deconstruction helpers in the API library?
  • Can we remove ShopifyAPI::Auth::SessionStorage from SessionRepository now?

Reviewer's guide to testing

This is a risky change in that all API calls and authentication code has been modified. We'll want to perform a full regression of the features of the gem and ensure we can make rest / graphql calls with the new session interface.

Checklist

Before submitting the PR, please consider if any of the following are needed:

  • Update CHANGELOG.md if the changes would impact users
  • Update README.md, if appropriate.
  • Update any relevant pages in /docs, if necessary
  • For security fixes, the Disclosure Policy must be followed.

@nelsonwittwer nelsonwittwer changed the title WIP - Move ownership for session persistence from library to this gem Move ownership for session persistence from library to this gem Dec 7, 2022
Copy link
Contributor

@klenotiw klenotiw left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just to be sure I didn't miss out somewhere, I tested this by generating a new app. Then I installed it to a store and saw products. This should be enough right?

@nelsonwittwer
Copy link
Contributor Author

Thanks for the 🎩 , @klenotiw ! Before we release the next version, I'll do a test with the CLI to make sure everything looks good as well!

@nelsonwittwer nelsonwittwer merged commit a4d5c84 into main Dec 7, 2022
@nelsonwittwer nelsonwittwer deleted the nelsonwittwer/api_session branch December 7, 2022 18:02
fabriazza pushed a commit to fabriazza/shopify_app that referenced this pull request Feb 1, 2023
…ify#1563)

* session stored in rails instead of library

* move responsiblity for session persistence

* move load_current_session to login_protection

* FIXME notes

* Move session concerns back to session utils

* Add `embedded` param to `splash_page` (Shopify#1549)

* use online tokens appropriately if there is a user session storage available

* move load_current_session to login_protection

* Move session concerns back to session utils

* refactor login protection and tests with sesison ownership change

* rubocop'd

* no more session_storage in generated example

* add x86_65-linux platform for CI

* no more local pointer to api lib

* more gemlock

Co-authored-by: rdillensnyder <101280580+rdillensnyder@users.noreply.github.com>
Co-authored-by: Teddy Hwang <teddy.hwang@shopify.com>
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.

None yet

4 participants