Im trying to make a dropdown list of the signed in users Google contacts in my Meteor app, but can't seem to get the Google permissions to work right. I have Google Authentication working just fine, using accounts-base and accounts-google, and came across selectize-google-contacts package which uses the percolate:google-api to interact with Google's API, but keep getting the following error:
Exception in Google Api callAndRefresh: Error: Auth token not found.Connect your google account [403]
at Object.GoogleApi._call (http://localhost:3000/packages/percolate_google-api.js?f5ed85b086e156f073ebc853af885cee23fdedc3:132:16)
at Object.GoogleApi._callAndRefresh (http://localhost:3000/packages/percolate_google-api.js?f5ed85b086e156f073ebc853af885cee23fdedc3:92:10)
at Object.<anonymous> (http://localhost:3000/packages/percolate_google-api.js?f5ed85b086e156f073ebc853af885cee23fdedc3:155:17)
at Object.wrapAsync [as get] (http://localhost:3000/packages/percolate_google-api.js?f5ed85b086e156f073ebc853af885cee23fdedc3:53:17)
at Template.selectizeGoogleContacts.onRendered.$.selectize.load (http://localhost:3000/packages/rcy_selectize-google-contacts.js?3223a2bd0dd55e2f7ec72836f52e1172349b8426:105:17)
at null.<anonymous> (http://localhost:3000/packages/jeremy_selectize.js?c546a4e24dda2fb546e0e81461e3b48f81e80f0e:1608:8)
at $.extend.load (http://localhost:3000/packages/jeremy_selectize.js?c546a4e24dda2fb546e0e81461e3b48f81e80f0e:1743:7)
at $.extend.onSearchChange (http://localhost:3000/packages/jeremy_selectize.js?c546a4e24dda2fb546e0e81461e3b48f81e80f0e:1607:9)
at http://localhost:3000/packages/jeremy_selectize.js?c546a4e24dda2fb546e0e81461e3b48f81e80f0e:877:8
My server.js file looks like this:
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
// Google Login
ServiceConfiguration.configurations.remove({
service: "google"
});
ServiceConfiguration.configurations.insert({
service: "google",
requestPermissions:'https://www.googleapis.com/auth/contacts.readonly',
clientId: "00000000000",
loginStyle: "popup",
secret: "00000000000"
});
});
Im guessing that the requestPermissions:'https://www.googleapis.com/auth/contacts.readonly',
isn't the way to request permission to access contacts - any thoughts?
You need to request an offline token for this to work. The example app (which I have since added to the github repo for this package) has this client side setup: