fauxJax.waitFor(4, function(err, requests) {
    t.error(err);
    fauxJax.restore();

    var firstRequest = requests[0];
    var secondRequest = requests[1];
    var thirdRequest = requests[2];
    var fourthRequest = requests[3];

    firstRequest.respond(200, {}, '{}');
    secondRequest.respond(200, {}, '{}');
    thirdRequest.respond(200, {}, '{}');
    fourthRequest.respond(200, {}, '{}');

    if (process.browser) {
      t.notOk(
        parse(firstRequest.requestURL, true).query['x-great-header'],
        'No `X-great-header` set on first request'
      );

      t.equal(
        parse(secondRequest.requestURL, true).query['x-great-header'],
        'yay',
        '`X-great-header` set on second request'
      );

      t.equal(
        parse(thirdRequest.requestURL, true).query['x-great-header'],
        'yaw',
        '`X-great-header` set on third request'
      );

      t.notOk(
        parse(fourthRequest.requestURL, true).query['x-great-header'],
        'No `X-great-header` set on fourth request'
      );
    } else {
      t.notOk(
        firstRequest.requestHeaders['x-great-header'],
        'No `X-great-header` set on first request'
      );

      t.equal(
        secondRequest.requestHeaders['x-great-header'],
        'yay',
        '`X-great-header` set on second request'
      );

      t.equal(
        thirdRequest.requestHeaders['x-great-header'],
        'yaw',
        '`X-great-header` set on third request'
      );

      t.notOk(
        fourthRequest.requestHeaders['x-great-header'],
        'No `X-great-header` set on fourth request'
      );
    }
  });
function isNewPageUrl(node) {
    var linkUrl = parse(node.href);
    var winUrl = parse(global.location.href);
    if (linkUrl.toString().replace(linkUrl.hash, '') !== winUrl.toString().replace(winUrl.hash, '') && node.href) {
        return true;
    }
    return false;
}
  function cleanConfig(config, originalUrl) {
    if (config.yasqe.sparql && config.yasqe.sparql.endpoint && config.yasqe.sparql.endpoint.indexOf("http") !== 0) {
      //hmm, a relative path, do some magic to rewrite the endpoint
      var parsedOriginalUrl = urlParse(originalUrl);
      var parsedEndpointUrl = urlParse(config.yasqe.sparql.endpoint);
      parsedOriginalUrl.set("hash", parsedEndpointUrl.hash);
      parsedOriginalUrl.set("query", parsedEndpointUrl.query);
      parsedOriginalUrl.set("pathname", parsedEndpointUrl.pathname);
      config.yasqe.sparql.endpoint = parsedOriginalUrl.href;
    }

    return config;
  }
Example #4
0
    getUrl = () => {
        const urlParse = require('url-parse');
        let preUrl = urlParse(this.state.url, true);

        if (!preUrl.host || preUrl.protocol === 'file:') {
            preUrl = urlParse('https://' + stripTrailingSlashes(this.state.url), true);
        }

        if (preUrl.protocol === 'http:') {
            preUrl.protocol = 'https:';
        }

        return stripTrailingSlashes(preUrl.protocol + '//' + preUrl.host + preUrl.pathname);
    };
Example #5
0
    /**
     * @param {Object} options task options object
     * @param {Object} context graph context object
     * @param {String} taskId running task identifier
     * @constructor
     */
    function UcsDiscoveryJob(options, context, taskId) {
        UcsDiscoveryJob.super_.call(this,
                                   logger,
                                   options,
                                   context,
                                   taskId);

        assert.object(this.options);
        assert.string(this.options.uri);
        assert.string(this.options.username);
        assert.string(this.options.password);
        assert.string(this.options.ucs);
        var parse = urlParse(this.options.uri);
        var protocol = parse.protocol.replace(':','').trim();
        this.settings = {
            uri: parse.href,
            host: parse.host.split(':')[0],
            root: parse.pathname,
            port: parse.port,
            protocol: protocol,
            ucsUser: this.options.username,
            ucsPassword: this.options.password,
            ucsHost: this.options.ucs,
            verifySSL: this.options.verifySSL || false
        };
        this.ucs = new UcsTool();
        this.ucs.settings = this.settings;
    }
function ProxyingAgent(options, agent) {
  this.openSockets = {};
  this.options = util._extend({}, options);
  this.options.proxy = url(this.options.proxy);
  this.options.tunnel = this.options.tunnel || false;
  this.options.ssl = this.options.proxy.protocol ? this.options.proxy.protocol.toLowerCase() == 'https:' : false;
  this.options.host = this.options.proxy.hostname;
  this.options.port = this.options.proxy.port || (this.options.ssl ? 443 : 80);
  this.options.authType = this.options.authType || 'basic';

  if (this.options.authType === 'ntlm') {
    if (!this.options.proxy.auth) {
      throw new Error('NTLM authentication credentials must be provided');
    }
    if (!this.options.ntlm || !this.options.ntlm.domain) {
      throw new Error('NTLM domain must be provided');
    }
  }

  // base64 decode proxy auth if necessary
  var auth = this.options.proxy.auth;
  if (auth && auth.indexOf(':') == -1) {
    auth = new Buffer(auth, 'base64').toString('ascii');
    // if after decoding there still isn't a colon, then revert back to the original value
    if (auth.indexOf(':') == -1) {
      auth = this.options.proxy.auth;
    }
    this.options.proxy.auth = auth;
  }

  // select the Agent type to use based on the proxy protocol
  this.agent = agent;
  this.agent.call(this, this.options);
}
Example #7
0
    onLoadEnd = (event) => {
        const url = event.nativeEvent.url;
        if (url.includes(this.completedUrl)) {
            CookieManager.get(urlParse(url).origin, true).then((res) => {
                const token = res.MMAUTHTOKEN;

                if (token) {
                    this.setState({renderWebView: false});
                    const {
                        getSession,
                        handleSuccessfulLogin,
                        setStoreFromLocalData,
                    } = this.props.actions;

                    Client4.setToken(token);
                    setStoreFromLocalData({url: Client4.getUrl(), token}).
                        then(handleSuccessfulLogin).
                        then(getSession).
                        then(this.goToLoadTeam).
                        catch(this.onLoadEndError);
                } else if (this.webView && !this.state.error) {
                    this.webView.injectJavaScript(postMessageJS);
                }
            });
        }
    };
Example #8
0
 return _.forEach(clients, function(client) {
     var record = {};
     var parse = urlParse(client.Destination);
     var tool = new RedfishTool();
     tool.settings.host = parse.host.split(':')[0];
     tool.settings.port = parse.port;
     record.MemberId = event.node;
     record.EventType = "StatusChange";
     record.EventId = event.reading.sensorId;
     record.EventTimestamp = new Date().toISOString();
     record.Message = event.reading.entryIdName + ', statesAsserted: ' +
         event.reading.statesAsserted.toString();
     record.MessageId = "StatusChange.1.0." +
         event.reading.sensorId.replace(/[^A-Za-z0-9.]/g,'');
     return redfish.validateSchema(record, 'Event.v1_1_2.json#/definitions/EventRecord') //jshint ignore: line
     .then(function(result) {
         if(result.error) {
             throw new Error(result.error);
         }
         return sendClient(tool, retryAttempts, record);
     })
     .catch(function(error) {
         throw error;
     });
 });
Example #9
0
 return _.forEach(_.values(eventSubscriptions), function(client) {
     if(_.includes(client.EventTypes, event.EventType)) {
         var record = {};
         var parse = urlParse(client.Destination);
         var tool = new RedfishTool();
         tool.settings.host = parse.host.split(':')[0];
         tool.settings.port = parse.port;
         record.MemberId = 'EndPoints';
         record.EventType = event.EventType;
         record.EventId = event.pollerName + '_' + event.EventType;
         record.EventTimestamp = new Date().toISOString();
         record.Message = JSON.stringify(event.data);
         record.MessageId = event.EventType + ".1.0.EndPoints";
         return redfish.validateSchema(record, 'Event.v1_1_2.json#/definitions/EventRecord') //jshint ignore: line
         .then(function(result) {
             if(result.error) {
                 throw new Error(result.error);
             }
             return sendClient(tool, retryAttempts, record);
         })
         .catch(function(error) {
             throw error;
         });
     }
 });
Example #10
0
export function urlToUri(url) {
  const parts = parse(url, {});

  assertUrl(url);

  return parts.hostname + parts.pathname;
}
Example #11
0
function getDomain(url) {
  let domain = urlParse(url, false).host;
  if (domain && domain.startsWith("www.")) {
    domain = domain.slice(4);
  }
  return domain;
}
Example #12
0
    it('should include all adserver targeting in cust_params if pbjs.enableSendAllBids is true', function () {
      const adUnitsCopy = utils.deepClone(adUnit);
      adUnitsCopy.bids.push({
        'bidder': 'testBidder2',
        'params': {
          'placementId': '9333431',
          'video': {
            'skipppable': false,
            'playback_methods': ['auto_play_sound_off']
          }
        }
      });

      const bidCopy = utils.deepClone(bid);
      bidCopy.adserverTargeting = Object.assign(bidCopy.adserverTargeting, {
        hb_adid: 'ad_id',
      });

      const url = parse(buildDfpVideoUrl({
        adUnit: adUnitsCopy,
        bid: bidCopy,
        params: {
          'iu': 'my/adUnit'
        }
      }));
      const queryObject = parseQS(url.query);
      const customParams = parseQS('?' + decodeURIComponent(queryObject.cust_params));

      expect(customParams).to.have.property('hb_adid', 'ad_id');
      expect(customParams).to.have.property('hb_uuid', bid.videoCacheKey);
      expect(customParams).to.have.property('hb_cache_id', bid.videoCacheKey);
      expect(customParams).to.have.property('hb_bidder_appnexus', 'appnexus');
      expect(customParams).to.have.property('hb_bidder_testBidder2', 'testBidder2');
    });
Example #13
0
export const executeRequest = (req) => ({fn, specActions, specSelectors}) => {
  let { pathName, method, operation } = req

  let op = operation.toJS()

  // if url is relative, parseUrl makes it absolute by inferring from `window.location`
  req.contextUrl = parseUrl(specSelectors.url()).toString()


  if(op && op.operationId) {
    req.operationId = op.operationId
  } else if(op && pathName && method) {
    req.operationId = fn.opId(op, pathName, method)
  }

  let parsedRequest = Object.assign({}, req)
  parsedRequest = fn.buildRequest(parsedRequest)

  specActions.setRequest(req.pathName, req.method, parsedRequest)

  // track duration of request
  const startTime = Date.now()

  return fn.execute(req)
  .then( res => {
    res.duration = Date.now() - startTime
    specActions.setResponse(req.pathName, req.method, res)
  } )
  .catch( err => specActions.setResponse(req.pathName, req.method, { error: true, err: serializeError(err) } ) )
}
function selectSiteProperties(site) {
  const metadataFavicon = site.favicons && site.favicons[0] && site.favicons[0].url;
  const favicon = site.favicon_url || metadataFavicon || site.favicon;
  const parsedUrl = site.parsedUrl || urlParse(site.url || "");
  const label = prettyUrl(parsedUrl.hostname);
  return {favicon, parsedUrl, label};
}
        it('should call the correct Prebid URL when using the default URL', function () {
            var params = {
                bidderCode: 'piximedia',
                bidder: 'piximedia',
                bids: [
                        {
                            bidId: '4d3819cffc4d12',
                            sizes: [[300, 250]],
                            bidder: 'piximedia',
                            params: { siteId: 'TEST', placementId: "TEST" },
                            requestId: '59c318fd382219',
                            placementCode: '/20164912/header-bid-tag-0'
                        } 
                ]
            };

            adapter().callBids(params);
            var bidUrl = spyLoadScript.getCall(0).args[0];

            sinon.assert.calledWith(spyLoadScript, bidUrl);

            var parsedBidUrl = urlParse(bidUrl);
 
            expect(parsedBidUrl.hostname).to.equal("static.adserver.pm");
            expect(parsedBidUrl.query).to.equal("");
            expect(parsedBidUrl.pathname.replace(/cbid=[a-f0-9]+/, "cbid=210af5668b1e23").replace(/rand=[0-9]+$/, "rand=42")).to.equal("/prebid/site_id=TEST/placement_id=TEST/jsonp=pbjs.handlePiximediaCallback/sizes=300x250/cbid=210af5668b1e23/rand=42");
        });
Example #16
0
  fauxJax.waitFor(1, function(err, requests) {
    t.error(err);
    fauxJax.restore();

    requests[0].respond(200, {}, '{}');

    t.equal(
      1,
      requests.length,
      'We made one request'
    );

    t.equal(
      parse(requests[0].requestURL, true).pathname,
      '/1/indexes/*/queries',
      'Perform a single API call'
    );

    t.deepEqual(
      JSON.parse(requests[0].requestBody),
      {
        requests: [
          {params: 'query=first%20query'},
          {params: 'query=second%20query&hitsPerPage=42'}
        ]
      },
      'Perform 2 requests'
    );
  });
  function firstBrowse(req) {
    var parsedURL = parse(req.requestURL, true);

    t.equal(
      parsedURL.pathname,
      '/1/indexes/' + encodeURIComponent(fixture.credentials.indexName) + '/browse',
      'pathname matches'
    );
    t.deepEqual(
      JSON.parse(req.requestBody),
      {params: 'hitsPerPage=200&query=some'},
      'params matches'
    );

    req.respond(
      200,
      {},
      JSON.stringify({
        nbHits: 100,
        cursor: 'fslajf21rf31fé==!'
      })
    );

    fauxJax.once('request', secondBrowse);
  }
 action: function(curUrl, searchQuery) {
   var parsedUrl = urlParser(curUrl);
   
   var searchUrl = parsedUrl.protocol + '//' + parsedUrl.host + '/s/' + searchQuery;
   
   return searchUrl;
 }
Example #19
0
  it("set url parameters", function () {
    var stubLoadScript = sinon.stub(adLoader, "loadScript");

    adapter().callBids(DEFAULT_PARAMS);

    var smartCallback;
    for (var k in $$PREBID_GLOBAL$$) {
      if (k.lastIndexOf("sas_", 0) === 0) {
        smartCallback = k;
        break;
      }
    }

    var bidUrl = stubLoadScript.getCall(0).args[0];
    var parsedBidUrl = urlParse(bidUrl);
    var parsedBidUrlQueryString = querystringify.parse(parsedBidUrl.query);

    expect(parsedBidUrl.hostname).to.equal("www.smartadserver.com");
    expect(parsedBidUrl.pathname).to.equal("/prebid");

    expect(parsedBidUrlQueryString).to.have.property("pbjscbk").and.to.equal("pbjs." + smartCallback);
    expect(parsedBidUrlQueryString).to.have.property("siteid").and.to.equal("1234");
    expect(parsedBidUrlQueryString).to.have.property("pgid").and.to.equal("5678");
    expect(parsedBidUrlQueryString).to.have.property("fmtid").and.to.equal("90");
    expect(parsedBidUrlQueryString).to.have.property("tgt").and.to.equal("test=prebid");
    expect(parsedBidUrlQueryString).to.have.property("tag").and.to.equal("sas_42");
    expect(parsedBidUrlQueryString).to.have.property("sizes").and.to.equal("300x250,300x200");
    expect(parsedBidUrlQueryString).to.have.property("async").and.to.equal("1");

    stubLoadScript.restore();
  });
Example #20
0
    var stubLoadScript = sinon.stub(adLoader, "loadScript", function(url) {
      var bidUrl = stubLoadScript.getCall(0).args[0];
      var parsedBidUrl = urlParse(bidUrl);
      var parsedBidUrlQueryString = querystringify.parse(parsedBidUrl.query);

      pbjs[parsedBidUrlQueryString.pbjscbk.split(".")[1]](BID_RESPONSE);
    });
Example #21
0
 return _.forEach(clients, function(client) {
     var record = {};
     var parse = urlParse(client.Destination);
     var tool = new RedfishTool();
     tool.settings.host = parse.host.split(':')[0];
     tool.settings.port = parse.port;
     tool.settings.root = parse.pathname;
     tool.settings.recvTimeoutMs = timeoutInSeconds * 1000;
     record.MemberId = event.node;
     record.EventType = "Alert";
     record.EventId = event.reading.sensorId;
     record.EventTimestamp = new Date().toISOString();
     record.Severity = event.reading.status;
     record.Message = event.reading.entryIdName + ' ' +
         event.reading.sensorReading + ' ' +
         (event.reading.sensorReadingUnits ? event.reading.sensorReadingUnits : '');
     record.MessageId = "Alert.1.0." +
         event.reading.sensorId.replace(/[^A-Za-z0-9.]/g,'');
     return redfish.validateSchema(record, 'Event.v1_1_2.json#/definitions/EventRecord') //jshint ignore: line
     .then(function(result) {
         if(result.error) {
             throw new Error(result.error);
         }
         return sendClient(tool, retryAttempts, record);
     })
     .catch(function(error) {
         throw error;
     });
 });
Example #22
0
function setDatum(url, k, v) {
  var urlObj = parseUrl(url);
  var hashObj = urlHashObj(urlObj.hash);
  hashObj[k] = v;
  urlObj.set("hash", hashObjToString(hashObj));
  return urlObj.toString();
};
  function firstBrowse(req) {
    var parsedURL = parse(req.requestURL, true);

    t.equal(
      parsedURL.pathname,
      '/1/indexes/' +
        encodeURIComponent(fixture.credentials.indexName) +
        '/rules/search',
      'pathname matches'
    );
    t.deepEqual(
      JSON.parse(req.requestBody),
      {page: 0, hitsPerPage: 100},
      'params match'
    );

    req.respond(
      200,
      {},
      JSON.stringify({
        nbHits: 200,
        hits: arrayFrom({length: 100}, function(v, num) {
          return {
            objectID: 'some-qr-rule-' + num,
            condition: {pattern: 'hellomyfriendhowareyou??? ' + num, anchoring: 'is'},
            consequence: {params: {query: 'query-rule-integration-test'}},
            _highlightResult: {}
          };
        })
      })
    );

    fauxJax.once('request', secondBrowse);
  }
Example #24
0
    it('invokes a single bid request for a single valid placement', () => {

      const params = {
        bids: [allowedPlacement()]
      };

      adapter.callBids(params);
      sinon.assert.calledOnce(loadScriptStub);
      sinon.assert.notCalled(addBidResponseStub);
      sinon.assert.calledOnce(hasValidBidRequestSpy);

      expect(hasValidBidRequestSpy.returnValues[0]).to.be.equal(true);

      // validate request
      const bidRequest = loadScriptStub.getCall(0).args[0];
      const defaultBidUrl = urlParse(DEFAULT_ENDPOINT);
      const bidUrl = urlParse(bidRequest);
      const query = querystringify.parse(bidUrl.query);

      expect(bidUrl.hostname).to.equal(defaultBidUrl.hostname);
      expect(bidUrl.pathname).to.equal(defaultBidUrl.pathname);

      // adapter version
      expect(query).to.have.property('v');

      // callback
      expect(query).to.have.property('cb').and.to.equal('$$PREBID_GLOBAL$$.' + DEFAULT_CALLBACK_NAME);

      // batch key
      expect(query).to.have.property('bk').and.to.equal([DEFAULT_ENDPOINT,'1337','300x250'].join('-'));

      // placementCode
      expect(query).to.have.property('pc').and.to.equal('div-gpt-ad-12345-1');

      // account id
      expect(query).to.have.property('ac').and.to.equal('1337');

      // selectedSize
      expect(query).to.have.property('sz').and.to.equal('300x250');

      // bid request size list
      expect(query).to.have.property('szs').and.to.equal('300x250');

      // page url domain (hostname)
      expect(query).to.have.property('dom').and.to.equal(window.top.location.hostname);

    });
Example #25
0
 RedfishJob.prototype.collectManagersLogEntries = function(redfish) {
     var parse = urlParse(redfish.settings.uri);
     var rootPath = parse.pathname + '/';
     
     // Managers is a root resource
     return redfish.clientRequest(rootPath)
     .then(function(res) {
         assert.ok(_.has(res.body, 'Managers'),
             'Managers Resource');
         return redfish.clientRequest(res.body.Managers['@odata.id']);
     })
     .then(function(res) {
         assert.ok(_.has(res.body, 'Members'), 
             'Has Manager Members');
         return res.body.Members;
     })
     .map(function(member) {
         assert.object(member, 'Manager Member');
         return redfish.clientRequest(member['@odata.id']);
     })
     .map(function(res) {
         assert.ok(_.has(res.body, 'LogServices'), 
             'Has LogServices Resource');
         return redfish.clientRequest(res.body.LogServices['@odata.id']);
     })
     .map(function(res) {
         assert.ok(_.has(res.body, 'Members'), 
             'Has LogService Members');
         return res.body.Members;           
     })
     .map(function(member) {
         assert.object(member, 'Log Service Member');
         return redfish.clientRequest(member[0]['@odata.id']);
     })
     .map(function(res) {
         assert.ok(_.has(res.body, 'Entries'), 
             'Has LogServices Entries');
         return redfish.clientRequest(res.body.Entries['@odata.id']);
     })
     .map(function(res) {
         assert.ok(_.has(res.body, 'Members'), 
             'Has Entry Members');
         return res.body.Members;
     })
     .map(function(memberArr) {
         var promises = [];
         _.forEach(memberArr, function(member) {
             promises.push(redfish.clientRequest(member['@odata.id']));
         });
         return Promise.all(promises);
     })
     .map(function(resArr) {
         var data = [];
         _.forEach(resArr, function(res) {
             data.push(res.body); 
         });
         return data;
     });
 };
test('Request strategy uses only JSONP if one XHR fails', function(t) {
  t.plan(4);

  var fauxJax = require('faux-jax');
  var parse = require('url-parse');
  var sinon = require('sinon');

  var createFixture = require('../../../utils/create-fixture');

  var currentURL = parse(location.href);
  var fixture = createFixture({
    clientOptions: {
      hosts: [
        currentURL.host
      ],
      timeout: 5000
    },
    indexName: 'simple-JSONP-response'
  });

  var index = fixture.index;

  fauxJax.install();

  fauxJax.once('request', function(req) {
    fauxJax.restore();
    req.onerror();
  });

  var secondCallback = sinon.spy(function() {
    t.ok(
      secondCallback.calledOnce,
      'Second callback called once'
    );

    t.deepEqual(
      secondCallback.args[0],
      [null, {query: 'second'}],
      'Second callback called with null, {"query": "second"}'
    );
  });

  var firstCallback = sinon.spy(function() {
    t.ok(
      firstCallback.calledOnce,
      'First callback called once'
    );

    t.deepEqual(
      firstCallback.args[0],
      [null, {query: 'first'}],
      'First callback called with null, {"query": "first"}'
    );

    index.search('second', secondCallback);
  });

  index.search('first', firstCallback);
});
Example #27
0
  test('AngularJS module JSONP fallback', function(t) {
    t.plan(5);

    var fauxJax = require('faux-jax');
    var parse = require('url-parse');

    var currentURL = parse(location.href);

    // load AngularJS Algolia Search module
    require('../../../src/browser/builds/algoliasearch.angular');

    window.angular
      .module('angularJSONPFallback', ['algoliasearch'])
      .controller('AngularModuleSearchControllerTestJSONPFallback', ['$scope', '$timeout', 'algolia', function($scope, $timeout, algolia) {
        t.pass('AngularJS controller initialized');
        var client = algolia.Client('AngularJSError', 'ROCKSError', {
          hosts: [
            currentURL.host
          ],
          timeout: 5000
        });
        var index = client.initIndex('simple-JSONP-response');
        fauxJax.install();

        index.search('angular-first').then(function searchDone(content) {
          t.deepEqual(
            content, {
              query: 'angular-first'
            },
            'Content matches'
          );
        });

        index.search('angular-second', function searchDone(err, content) {
          t.error(
            err,
            'No error while using the callback interface'
          );

          t.deepEqual(
            content, {
              query: 'angular-second'
            },
            'Content matches'
          );
        });

        fauxJax.waitFor(2, function(err, requests) {
          t.error(err);
          requests[0].respond(500, {}, JSON.stringify({message: 'Nope promise'}));
          requests[1].respond(500, {}, JSON.stringify({message: 'Nope callback'}));
          fauxJax.restore();
        });
      }]);

    window.angular.element(document).ready(function() {
      window.angular.bootstrap(window.angular.element('#angular-JSONP-fallback'), ['angularJSONPFallback']);
    });
  });
Example #28
0
export async function getFolderDetails({url}) {
  const {pathname} = parse(url);
  const fileId = last(pathname.split('/'));

  const {client: {drive}} = await loadAndConfigureGapi();
  const {result} = await drive.files.get({fileId});
  return result;
}
 }, function(req) {
   t.equal(
     parse(req.requestURL).hostname,
     workingHost,
     'Second client, first search, first request done on ' + workingHost
   );
   req.respond(200, {}, JSON.stringify({message: 'Second client, first search, first request'}));
 }, function(req) {
Example #30
0
 mainWindow.webContents.on("did-get-redirect-request", (event, oldUrl, newUrl) => {
   let tokenURL = parse(newUrl, true);
   let params = parseQueryString(tokenURL.hash);
   if (params.id_token != null) {
     console.log("Token: " + params.id_token);
     accessToken = params.id_token;      
   }
 });