Created
January 15, 2019 18:01
-
-
Save karen-white/5fe27a3afd219d15f1232fbb56b15b67 to your computer and use it in GitHub Desktop.
Create Auth route
This file contains hidden or 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
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