Getting the install process correct for your Shopify app can be tricky. I think this is why some developers get stumped after they’ve gotten the permanent
access_token. What do they do now?
The correct answer is… anything!
Post OAuth install
After a shop has installed your app, you can use their
access_token to call any API on Shopify.
For public apps you will be limited by the OAuth scope you configured. Private apps don’t have this problem because their authentication grants access to anything and everything.
Important Shopify data to save to your app
That said, there are some important data you should gather right away for the shop.
The myshopify.com address which used in API calls. This comes from the shop user when they started the install process so you should make sure to save it then.
access_token which is required for all authenticated API calls. You get it in the final stage of the OAuth flow.
The actual, human name for the shop. From the Shop API in the
The email address for the account owner, which is useful if you want to contact your app customers or to connect to support requests. From the Shop API in the
customer_email which is the address used on the shop’s frontend for customers.
The Shopify plan the shop is on. This is important because some APIs are only available to higher plans. From the Shop API in the
A Ruby example
Much of this data is stored in the Shop API which is easy to access if you’re using Ruby and the Shopify API gem. Just call
ShopifyAPI::Shop.current and you’ll get back all of the shop data.
A quick example of this in Ruby on Rails would be:
class Shop < ActiveRecord::Base def retrieve_and_save_store_data session = ShopifyAPI::Session.new(self.shopify_domain, self.shopify_token) @shop_data = ShopifyAPI::Shop.current self.shop_name = @shop_data.name self.shop_email = @shop_data.email self.plan = @shop_data.plan_name self.save end end
Don’t forget to capture the install data your app needs
This is a short list of data that every Shopify app should capture on install. The only two that are required are the myshopify.com address and the
access_token. Without those you cannot make any other API calls from your app.
Depending on your app’s features you’ll want to capture more, maybe even importing a lot of historic data like orders in the past month.
Would you like to get a daily tip about Shopify?
Sign up for Eric's Daily Shopify Tips to get my daily email with a tip for Shopify every morning.
Each tip includes a way improve your store: customer analysis, analytics, traffic, SEO, customer acquisition, Rich Results, CRO... plus plenty of puns and amazing alliterations.
Plus you'll get free access to my Premium Resource Center for free.
Join 4,400+ other Shopify store owners and sign up before the next tip is sent.