Shopify / koa-shopify-auth

DEPRECATED Middleware to authenticate a Koa application with Shopify
MIT License
80 stars 64 forks source link

How to redirect as a "Sales Channel" #120

Closed g-hamilton closed 1 year ago

g-hamilton commented 3 years ago

Hi,

In the afterAuth method, I need to redirect the user to my embedded app, which is a sales channel.

Using the method as per your guide/example:

ctx.redirect(`/?shop=${shop}&host=${host}`);

This redirects me here:

https://test-shop.myshopify.com/admin/apps/41d33bca21f2a6a7f7ade535087632eb/?shop=test-shop.myshopify.com&host=aGFtc3RlcnMtY29mZmVlLm15c2hvcGlmeS5jb20vYWRtaV9

Which puts me on the "Apps" tab of my test shop, and which says "There's no page at this address".

I don't want to redirect to the "Apps" tab. I do want to redirect to my app in the "Sales Channels" tab. After app install, if I hover the mouse over my sales channel app in the shop admin, I note that the URL is:

https://test-shop.myshopify.com/admin/apps/app-2?channel=true

Note the channel query param in the URL

So I'm not sure if this is a bug or not, but if I simply append a channel param like so:

ctx.redirect(`/?shop=${shop}&host=${host}&channel=true`);

The channel param is stripped away and I still end up on the "Apps" tab rather than "Sales Channels". How do I redirect my users to the correct place after installing my sales channel?

Thanks

abeaclark commented 2 years ago

@g-hamilton did you end up solving this?

github-actions[bot] commented 1 year ago

Note that this repo is no longer maintained and this issue will not be reviewed. Prefer the official JavaScript API library. If you still want to use Koa, see simple-koa-shopify-auth for a potential community solution.