router.get('/api/storage/signin', function (req, res) { req.session.csrf = cryptiles.randomString(24); var url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?' + 'client_id=' + config.storage.credentials.client_id + '&redirect_uri=' + config.storage.callbackURL + '&scope=user.read%20files.readwrite%20files.readwrite.all%20sites.read.all%20sites.readwrite.all' + '&state=' + req.session.csrf + '&response_type=code' res.end(url) });
router.get('/api/storage/signin', function (req, res) { req.session.csrf = cryptiles.randomString(24); req.session.egnyteURL = req.query.accountUrl; var url = req.session.egnyteURL + '/puboauth/token?' + 'client_id=' + config.storage.credentials.client_id + '&redirect_uri=' + config.storage.callbackURL + '&scope=Egnyte.filesystem' + '&state=' + req.session.csrf + '&response_type=code' res.end(url); });
router.get('/api/storage/signin', function (req, res) { req.session.csrf = cryptiles.randomString(24); var dbx = new Dropbox({ clientId: config.storage.credentials.client_id }); var url = dbx.getAuthenticationUrl(config.storage.callbackURL, req.session.csrf); url = url.replace("token", "code") res.end(url) });
// return the forge authenticate url router.get('/user/authenticate', function (req, res) { req.session.csrf = cryptiles.randomString(24); console.log('using csrf: ' + req.session.csrf); console.log('/user/authenticate'); // redirect the user to this page var url = "https://developer.api.autodesk.com" + '/authentication/v1/authorize?response_type=code' + '&client_id=' + config.credentials.client_id + '&redirect_uri=' + config.callbackURL + '&state=' + req.session.csrf + '&scope=' + config.scopeInternal.join(" "); res.end(url); });
router.get('/api/storage/signin', function (req, res) { req.session.csrf = cryptiles.randomString(24); var url = 'https://account.box.com/api/oauth2/authorize?response_type=code&' + '&client_id=' + config.storage.credentials.client_id + '&redirect_uri=' + config.storage.callbackURL.toLowerCase() + '&state=' + req.session.csrf; res.end(url); });
router.get('/api/storage/signin', function (req, res) { req.session.csrf = cryptiles.randomString(24); var oauth2Client = new googleSdk.auth.OAuth2( config.storage.credentials.client_id, config.storage.credentials.client_secret, config.storage.callbackURL); var scopes = [ 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/userinfo.profile' ]; var url = oauth2Client.generateAuthUrl({ access_type: 'offline', // 'online' (default) or 'offline' (gets refresh_token) scope: scopes, // If you only need one scope you can pass it as string state: req.session.csrf }); res.end(url); });
// return the forge authenticate url router.get('/user/authenticate', function (req, res) { req.session.csrf = cryptiles.randomString(24); console.log('using csrf: ' + req.session.csrf); console.log('/user/authenticate'); // redirect the user to this page var url = "https://developer.api.autodesk.com" + '/authentication/v1/authorize?response_type=code' + '&client_id=' + config.credentials.client_id + '&redirect_uri=' + config.callbackURL + '&state=' + req.session.csrf + '&scope=' + config.scopeInternal.join(" "); res.end(url); });