dreemgl
Version:
DreemGL is an open-source multi-screen prototyping framework for mediated environments, with a visual editor and shader styling for webGL and DALi runtimes written in JavaScript. As a toolkit for gpu-accelerated multiscreen development, DreemGL includes
38 lines (33 loc) • 1.22 kB
JavaScript
module.exports = (function() {
"use strict";
var open = require("open"),
prompt = require("prompt"),
ExchangeTokens = require("./exchange");
/**
* Second part of oauth: request authorization
*/
var RequestAuthorization = function(options, requestCompleted) {
options.permissions = options.permissions || "read";
var oauth_token = options.oauth_token,
oauth_token_secret = options.oauth_token_secret,
authURL = "https://www.flickr.com/services/oauth/authorize",
browserURL = authURL + "?oauth_token=" + oauth_token + "&perms=" + options.permissions;
// are we in the browser?
if(!options.nobrowser) { open(browserURL); }
else { console.log("please visit " + browserURL); }
if(options.callback === "oob") {
prompt.start();
prompt.get(['oauth_verifier'], function(err, res) {
options.oauth_verifier = res.oauth_verifier.trim();
new ExchangeTokens(options, requestCompleted);
});
}
else {
options.exchange = function(tokens) {
options.oauth_verifier = tokens.oauth_verifier;
new ExchangeTokens(options, requestCompleted);
};
}
};
return RequestAuthorization;
}());