Skip to content

Instantly share code, notes, and snippets.

@karen-white
Created January 15, 2019 18:01
Show Gist options
  • Save karen-white/5fe27a3afd219d15f1232fbb56b15b67 to your computer and use it in GitHub Desktop.
Save karen-white/5fe27a3afd219d15f1232fbb56b15b67 to your computer and use it in GitHub Desktop.
Create Auth route
const express = require('express'),
router = express.Router(),
BigCommerce = require('node-bigcommerce');
const bigCommerce = new BigCommerce({
clientId: 'your Client Id from app registration',
secret: 'your Client Secret from app registration',
callback: 'https://your-ngrokURL/auth',
responseType: 'json'
});
router.get('/', (req, res, next) => {
bigCommerce.authorize(req.query)
.then(data => console.log(data))
.then(data => res.render('auth', { title: 'Authorized!' })
.catch(err));
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment