Add a Google API to the meteor project

advertisements

i'm trying to link Google API to my meteor project but cant seem to make it load. Docs say to add

script src="https://apis.google.com/js/client.js?onload=OnLoadCallback"></script>

to the header, which we cant do straight in meteor.

I tried getting a local copy of the script and adding it to client folder but still get 'gapi is not defined' when loading. This approach worked with filepicker.io but not on this one.

Any idea where or how to load the library?


You can use Meteor's built in external services for auth, they have a specific one for google: http://docs.meteor.com/#meteor_loginwithexternalservice

To load the client API just include this in the <head> section of your application's main html file.

<script src="https://apis.google.com/js/client.js?onload=OnLoadCallback"></script>

You can confirm it has loaded correctly by running gapi in the console