Installing a Shopify app into a dev shop

If you’ve been following the instructions to build a Shopify “app”, you may reach the end and feel like you’ve been asked to draw an owl instead.

There are a few pointers here and there on the internet, but these are the steps I went through.

First, while logged in, request the permissions you want:

https://shop.myshopify.com/admin/oauth/authorize?client_id=app_api_key&scope=required_scopes

You’ll then be redirected to the url you set up for your shop. If you don’t want to go through the hassle of actually deploying something yet, fear not. You can take the uri you were redirected to:

https://app_uri/?code=auth_code&shop=shop.myshopify.com&signature=signature×tamp=timestamp

And exchange the auth code for a re-usable token:

curl -d "client_id={app_id}&client_secret={app_secret}&code={auth_code}" https://{shop}.myshopify.com/admin/oauth/access_token

{"access_token":"{token}"}

That will grant you access, within the scopes that you requested:

curl -H "X-Shopify-Access-Token: {token}" -H "Content-Type: application/json" -d "{\"script_tag\":{\"event\":\"onload\",\"src\":\"https://foo.net/bar.js\"}}" https://{shop}.myshopify.com/admin/script_tags.json
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s