Loading google client.js

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • I'm a bit of a javascript beginner and am finding it a problem to get google api authorization (oauth2) under node-webkit. There may well be fundamental problems with doing this that I'm just not aware of.

    I borrowed abit of code from thehen and flurry, as you see below. On running, a popup appears saying 'setApiKey' is undefined. Looking in the client.js library (which is minified), I can't see any 'setApiKey' method. Maybe client.js loads another external library? (I've got no idea really and hope someone can point me in the right direction.) Thanks.

    var s = document.createElement("script");

              s.src = "https://apis.google.com/js/client.js";

              s.async = true;

              document.getElementsByTagName("head")[0].appendChild(s);

              s.onload = function() {

        gapi.client.setApiKey('AIzaSyCtG9M0qrfx...SE6bcDRKAQoX5u5do');

                   self.gapi_ready = true;

              }

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, I have it authenticating in node-webkit. I used 'google-api-nodejs-client'.

    Ashley, currently I place the 'node_modules' in my home directory because I couldn't get it working any other way. I read Roger Wangs article at github.com/rogerwang/node-webkit/wiki/Using-Node-modules, but still can't work out how to run node-webkit with modules, where they are not global (i.e. in my home dir). Thanks.

  • I can't really help you here, it's not really anything specific to the Javascript SDK. A site like stackoverflow.com might be able to help better.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)