Direct link to install my app

ClementG
Shopify Partner
660 0 128

If I understand correctly, going to http://myshopify.com/admin/api/auth?api_key=<api_key> is basically the same as if the merchant went to the app store and click 'Install' for the app matching the api key in the url. Right?

This is great because it allows to share a url to trigger the installation of the app.

The way it seems to work is that this url is redirected by shopify to the app url, and it's up to the app's page logic to implement the oauth flow.

Is there a way to somehow pass query parameters to that url, such that they are forwarded to the app url? Quick testing seems to indicate that query parameters are not forwarded.

I'm trying to achieve a kind of deep linking, where I want to pass the specific app url that the user should be presented with once the application is installed.

Is this possible?

0 Likes
ClementG
Shopify Partner
660 0 128

I guess that's a no for that one.

0 Likes
Pogodan
Shopify Expert
76 0 11

You can just embed parameters within the URL (host/path) itself, pather than as query params. E.g. https://[param].myapp.com or https://myapp.com/[param1]/[param2]/

Pogodan | https://experts.shopify.com/pogodan-dev
0 Likes
ClementG
Shopify Partner
660 0 128

But that wouldn't help because one can configure only a single app url, and I have many possible parameter values.

 

0 Likes
Pogodan
Shopify Expert
76 0 11

Hmm. Can you just trigger the install from your end, rather than passing the client to the Shopify app page? e.g. if you're using a standard oauth setup, you might go to a URL like:

https://myapp.com/auth/shopify?shop=[a-shop].myshopify.com

So whatever custom params you need you can just manage on your end, store in session/DB and then initiate the oauth install process (you can even then send them through the standard app store install process, as long as your server is able to match-up the account as they get sent back in)

Pogodan | https://experts.shopify.com/pogodan-dev
0 Likes
ClementG
Shopify Partner
660 0 128

Thanks for your suggestion.

One issue is that when a merchant clicks a link like https://myapp.com/[param1]/[param2]/, this will not pass in the shopid to my app. This is why http://myshopify.com/admin/api/auth?api_key=<api_key> is useful.

The session/db/cookie solution could be cobbled together but I'm really trying to avoid any state hanging around like this, as it's not very reliable/clean.

I will probably have to hack something like that, but it would be a lot cleaner if there was a way of passing parameters directly in the oauth app url...

0 Likes
Ari9
Excursionist
18 1 1

For me, it was a simple matter of setting `same-site` to `none` on my cookie Hope this helps!

0 Likes