This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from uniquelyparticular/feature/cleanup
feat: cleaned up to match provider implementations
- Loading branch information
Showing
21 changed files
with
15,624 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
|
||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
|
||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
|
||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"jsxBracketSameLine": true, | ||
"semi": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,95 @@ | ||
# generic-oauth | ||
# @particular./serverless-oauth | ||
|
||
[![npm version](https://img.shields.io/npm/v/@particular./serverless-oauth.svg)](https://www.npmjs.com/package/@particular./serverless-oauth) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![CircleCI](https://img.shields.io/circleci/project/github/uniquelyparticular/serverless-oauth.svg?label=circleci)](https://circleci.com/gh/uniquelyparticular/serverless-oauth) | ||
|
||
> 🎮 Minimal OAuth implementation using Serverless! | ||
Built with [Micro](https://github.com/zeit/micro)! 🤩 | ||
|
||
## 🛠 Setup | ||
|
||
Both a [Shopify](https://shopify.com) _and_ [Firebase](https://firebase.google.com) account are needed for this to function _(NOTE: this is only temporary)_. | ||
|
||
Start ngrok (change ngrok port below from 3000 if going to run yarn dev on different port or if already in use) | ||
|
||
```bash | ||
ngrok http 3000 | ||
``` | ||
|
||
Make a note of the https `ngrok URL` provided. | ||
|
||
--- | ||
|
||
Create a `.env` at the project root with the following credentials: | ||
|
||
```dosini | ||
DEPLOYED_URI | ||
FIREBASE_API_KEY | ||
FIREBASE_PROJECT_ID | ||
SHOPIFY_OAUTH_SCOPES | ||
SHOPIFY_API_KEY | ||
SHOPIFY_API_SECRET | ||
``` | ||
|
||
--- | ||
|
||
`DEPLOYED_URI` should be set to your `ngrok URL` from above (ie. `https://312a9670.ngrok.io`) | ||
|
||
Open the [Firebase Console](https://console.firebase.google.com) to create a new Project (or you can use an existing one) to use for storing temporary nonce date. Click `Add Project`, enter anything in the `Project Name` field then click `Create Project`. When you receive the 'Your new project is ready' confirmation, click `Continue`. Under the 'Get started by adding Firebase to your app', click the icon for `Web` < /> and then in that popup you will find your configuration information to use for `FIREBASE_API_KEY` (apiKey) and `FIREBASE_PROJECT_ID` (projectId). | ||
|
||
--- | ||
|
||
`SHOPIFY_OAUTH_SCOPES` can be set to any of the following values: `read_products`,`read_product_listings`,`read_customers`,`write_customers`,`write_orders,write_draft_orders`,`write_shipping`,`write_checkouts`,`read_shopify_payments_disputes`,`unauthenticated_read_product_listings`,`unauthenticated_write_checkouts`,`unauthenticated_write_customers`. | ||
|
||
Navigate to your [Shopify Partner Dashboard](https://partners.shopify.com/<<PartnerId>>/apps)'s App section and clicking `Create App`. | ||
|
||
You can enter any value for `App Name`. | ||
|
||
In the `App URL` field, be sure to enter your `ngrok URL` (provided above) followed by `/auth` such that `App URL` looks something like `https://312a9670.ngrok.io/auth`. | ||
|
||
In the `Whitelisted redirection URL(s)` field, be sure to enter your `ngrok URL` (provided above) followed by `/auth/callback` such that `App URL` looks something like `https://312a9670.ngrok.io/auth/callback`. | ||
|
||
Click the `Create app` button to create your App Credentials and find your `SHOPIFY_API_KEY` and `SHOPIFY_API_SECRET`. | ||
|
||
## 📦 Package | ||
|
||
Run the following command to build the app | ||
|
||
```bash | ||
yarn install | ||
``` | ||
|
||
Start the development server | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
The server will typically start on PORT `3000`. If not, you'll need to restart ngrok to point to whatever server port you've started here. | ||
|
||
## ⛽️ Usage | ||
|
||
Once your server is up and running, navigate back to your [Shopify Partner Dashboard](https://partners.shopify.com/<<PartnerId>>/apps)'s App section and clicking on the App you installed above (if you're not still there). | ||
|
||
Open the `Test your app` accordian button > Select a store from the dropdown > Click the `Install app on store` button and follow the prompts to confirm your installation and `Install Unlisted app`. | ||
|
||
**_Make a note of the `access_token` provided as you will need it for making subsequent API calls._** | ||
|
||
**NOTE**: this repository works extremely well with our `@particular./shopify-auth` package which is available via `npm` or at: | ||
https://github.com/uniquelyparticular/shopify-request. | ||
|
||
```js | ||
const { createClient } = require('@particular./shopify-request'); | ||
// import { createClient } from '@particular./shopify-request' | ||
|
||
const shopify = new createClient({ | ||
store_name: '...', //Shopify Store Name | ||
access_token: access_token //Shopify OAuth token received after registering as Public App and installing to Store above | ||
}); | ||
``` | ||
|
||
## 🚀 Deploy | ||
|
||
You can easily deploy this function to [now](https://now.sh). | ||
|
||
_Contact [Adam Grohs](https://www.linkedin.com/in/adamgrohs/) @ [Particular.](https://uniquelyparticular.com) for any questions._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
module.exports = { | ||
roots: ['<rootDir>/src', '<rootDir>/tests'], | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$', | ||
moduleFileExtensions: ['js', 'jsx', 'json', 'node'], | ||
roots: ['<rootDir>/src', '<rootDir>/tests', '<rootDir>/spec'], | ||
transform: { | ||
'^.+\\.ts(x)?$': 'ts-jest', | ||
}, | ||
verbose: true, | ||
testURL: 'http://localhost/', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.