Code Monkey home page Code Monkey logo

shopify-node-auth's Introduction

Shopify App Authentication with Nodejs

This is a boilerplate to be used if you want to create an embedded application for Shopify.

Project structure

This project includes a NodeJs server that will deliver static files at a specified port. When creating embedded applications at Shopify you need to create an Oauth flux in order to authenticate and install the app in a Shopify Store.

app.js will contain the server configuration and will serve static files from the public folder.

Pay special attention to the config folder as it will contain all the information needed to authenticate at Shopify.

OAuth data is contained at auth.development and auth.production. Two files exist because some of these properties can be different for different environments.

At the routes folder you can define more routes to access Shopify APIS, however this will need additional configuration. After the installation of the app, a permanent token is generated for that shop, and you need to store it somewhere.

If you want to know more about how the Authentication works, please visit the official documentation.

OAuth Process

  1. When a request to the / route is sent, the application will check if the application has been installed and has previous granted access, or simply it will render an HTML file.

  2. The first time a user calls your shop, it will trigger the Authentication flux, generating a nonce, and then redirecting to an URI generated by a Shopify method

shopifyToken.generateAuthUrl(shopifyToken.shop, undefined, nonce);

  1. This will open a login prompt in the browser in which the user will need to enter his login and password.

  2. After successfully login, the user will be asked for permission to install the application.

  3. After the confirmation, a recurring charge will be created. This recurring charge was set by default to test which indicates that it won't charge the user for this and that it's a test install.

  4. After accepting the charges, the app will be installed and redirected to the specified URL at the Partner's Shop App configuration.

  5. After that, you will be ready to access your app under the Apps menu inside your Shop.

Deploy

There are so many tools that can be used for deploying small apps, however if you want to deploy an application in a matter of minutes, wedeploy can be a good choice.

Additional configuration will be nedded from the Shopify Partners account, under Apps menu.

Testing the App

After deploying your application in your server, you should call this URL at your browser

https://your-server-domain.com?shop=your-shop-name.myshopify.com

This will simulate a real installation from the Shopify Store link when the user clicks at the install button.

shopify-node-auth's People

Contributors

jprivillaso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.