Shopify / Shopify/shopify_app

Migrating from shop-based to user-based token strategy

Open
#1,837 9 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

Issue summary

Before opening this issue, I have:

  • shopify_app version: 21.10

  • Ruby version: 3.3.0

  • Found a reliable way to reproduce the problem that indicates it's a problem with the package

  • Looked for similar issues in this repository

  • Checked that this isn't an issue with a Shopify API

I am moving an existing app with existing shops using the app from shop-based token to user-based token
I followed the 3 steps listed here: https://github.com/Shopify/shopify_app/blob/main/docs/shopify_app/sessions.md#migrating-from-shop-based-to-user-based-token-strategy

My belief is that it means I keep shops and users at the same time

When I try to install the app I see multiple OAuth attempts in my logs (goes to '/login?host...' then '/auth/shopify/callback?...' multiple times in a row)
Then the webpage shows an error mentioning too many redirects and I am taken back to Shopify Admin and shown an error message that an error occurred with the app

Expected behavior

App is installed / open / goes through OAuth, and user is created or found in the app db (same as what happens with shops basically)

Actual behavior

Error message, multiple OAuth attempts / redirects (as described above)

Steps to reproduce the problem

  1. Take an existing app with shop-based token
  2. Follow 3 steps to migrate to user-based token (link above)
  3. Open app / install app on store

Debug logs

Screenshot 2024-05-02 at 00 41 03

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 the migration instructions in docs/shopify_app/sessions.md, then trace the /login and /auth/shopify/callback entry points during the reproduced install. Compare the OAuth redirect sequence with the expected user creation or lookup and verify the flow completes without repeated redirects.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.