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
"use strict"; | |
var restify = require("restify"); | |
var users = require("./users"); | |
// The users module will have a getAuthorizationFromAccessTokenAsync promise-returning export. (Convert to callbacks if you wish). | |
// It rejects in cause of not authorized, or fulfills with a { scope, customerId } object if the user is authorized. | |
// The scope property indicates which scopes the user corresponding to a given access token has. | |
module.exports = function authPlugin(serverRequest, serverResponse, next) { |
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
/** | |
* npm install jsdom | |
* npm install jquery | |
*/ | |
var html = "<!doctype html><html><body><h1>Hello world!</h1></body></html>"; | |
/* parse the html and create a dom window */ | |
var window = require('jsdom').jsdom(html, null, { | |
// standard options: disable loading other assets |