I'm using Shopify Node Api to build my first proper app. I'm trying to build an express.js boilerplate that I can release as an NPM package. Every app I've built so far has been private - but this is my first attempt at one using Oauth.
https://github.com/christophergregory/shopify-node-api
I'm trying to figure out how I can install the app to a particular shop. I do not know how to get the store name. When someone clicks "install app" - I'm guessing a parameter is sent? However, I wont get an install button until the app is published on the store... (catch 22?)
So far, I've hard wired the store name into the config. I then hit the main root of the app, and run the install stuff. I then grab the access token and save it to a database.
<!-- language: lang-js -->
var config = {
shop: 'example', // MYSHOP.myshopify.com
// scopes, api-key, api-secret etc..
redirect_uri: 'http://localhost:3000/finish_auth',
verbose: false,
nonce: '' // a randomly selected value unique for each authorization request
}
var Shopify = new shopifyAPI(config);
var auth_url = Shopify.buildAuthURL();
app.get('/', function(req, res) {
res.redirect(auth_url);
});
How would I make this dynamic - so it can be installed to any store?