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

Loading session docs #1700

Merged
merged 4 commits into from
Jul 19, 2023
Merged

Loading session docs #1700

merged 4 commits into from
Jul 19, 2023

Conversation

nelsonwittwer
Copy link
Contributor

What this PR does

Clarify how sessions are loaded and what controller concerns should be used. Adds the missing initializer docs for shop/user session persistence.

docs/shopify_app/sessions.md Show resolved Hide resolved
`ShopifyApp::SessionRepository` allows you as a developer to define how your sessions are stored and retrieved for shops. The `SessionRepository` is configured in the `config/initializers/shopify_app.rb` file and can be set to any object that implements `self.store(auth_session, *args)` which stores the session and returns a unique identifier and `self.retrieve(id)` which returns a `ShopifyAPI::Session` for the passed id. These methods are already implemented as part of the `ShopifyApp::SessionStorage` concern but can be overridden for custom implementation.

### Loading Sessions
By using the appropriate controller concern, sessions are loaded for you. `RequireKnownShop` controller concern will load a shop session with the `installed_shop_session` helper. `EnsureHasSession` controller concern will load a user session via `current_shopify_session`. Note -- these controller concerns cannot both be included in the same controller.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we go into a bit more detail on what each of those methods mean in practice? Might be a good place for it!

@nelsonwittwer nelsonwittwer merged commit 2f90af4 into main Jul 19, 2023
8 checks passed
@nelsonwittwer nelsonwittwer deleted the nelsonwittwer/session_docs branch July 19, 2023 18:43
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