Shopify / Shopify/shopify_app

Better documentation for `EnsureAuthenticatedLinks`?

Open
#2,049 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.9k
Forks
739
Avg merge
21h 2m
Merged PRs (30d)
1

Description

Overview/summary

Hi,
The current documentation for EnsureAuthenticatedLinks is really sparse. It simply says "Designed to be more of a lightweight session concern specifically for XHR requests. Where EnsureHasSession does far more than just session management, this concern will redirect to the splash page of the app if no active session was found."

Can you please elaborate on it to add instructions on how to use it? For example:

  1. I assume EnsureAuthenticatedLinks goes in AuthenticatedController, but is it required to come after include ShopifyApp::EnsureHasSession or is it not even needed if EnsureHasSession is included? For example, we noticed that having EnsureAuthenticatedLinks come before EnsureHasSession causes AbstractController::DoubleRenderError.
  2. Is EnsureAuthenticatedLinks required for Turbo / TurboLinks if we already get the token via app-bridge.js -> shopify.idToken(); and pass it via XHR requests?
  3. Does config.embedded_redirect_url in shopify_app.rb need to be set as well? If so, what should it be set to? Is it supposed to be set to root_path or path that gets the token via app-bridge.js -> shopify.idToken(); (i.e. SplashPageController)?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/shopify_app/controller-concerns.md and the existing EnsureAuthenticatedLinks and EnsureHasSession references. Read the concern entry points and related configuration mentioned in the issue, then document when each concern is used, their ordering, Turbo or TurboLinks considerations, and embedded_redirect_url usage. Done means the documentation answers the three listed questions with verified examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.