Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Ramesh authored and Siddharth Ramesh committed Jan 28, 2021
1 parent d32ac2f commit c22dfe9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
# shopify-auth-node
# Shopify Auth Node

NodeJS + Express authentication handler for public shopify apps that:
1. Provides the path for Shopify callbacks during installation.
2. Validates & Handles authentication automatically.
3. Provides accessToken & shop name in the callback after successful authentication.
4. Provides a re-login path
5. Provides a path for GDPR handler

## Installation

Use the package manager [npm](http://npmjs.com/package/shopify-auth-node) to install Shopify Auth Node.

```bash
npm install shopify-auth-node
```

## Usage

```
const shopifyAuthNode = require('shopify-auth-node');
const express = require('express');
const app = express();
shopifyAuthNode.bootstrap({
app, // express server instance
shopifyAppScopes: 'read_script_tags,write_script_tags', // etc
shopifyApiKey: 'your_api_key',
shopifyApiSecret: 'your_api_secret',
shopifyAppUri: 'your_app_url_which_hosts_this_code',
successCallBack: ({ accessToken, shop, res }) => yourHandler()
})
```

## Setting on Shopify App Setup Page
1. Set your app URL to ```https://your_app_url.xyz/shopify```
2. Set your GDPR URL's to:
```
https:///your_app_url.xyz/shopify/webhooks/customers/data_request
https://your_app_url.xyz/shopify/webhooks/customers/redact
https://your_app_url.xyz/shopify/webhooks/shop/redact
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)
3 changes: 0 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,5 @@ module.exports = {
app.post(SHOPIFY_WEBHOOK_GDPR_CUSTOMERS_REDACT, handleGDPR);
app.post(SHOPIFY_WEBHOOK_GDPR_CUSTOMERS_DATA_REQUEST, handleGDPR);
app.post(SHOPIFY_WEBHOOK_GDPR_SHOP_REDACT, handleGDPR);
app.get(SHOPIFY_WEBHOOK_APP_UNISTALLED, (req, res) => {
// Script tags get deleted automatically after app is uninstalled
});
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shopify-auth-node",
"version": "1.0.3",
"version": "1.0.4",
"description": "package to handle shopify authentication with one function call",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c22dfe9

Please sign in to comment.