Open marcoschwartz opened 9 years ago
Hi @marcoschwartz does this help: https://github.com/percolatestudio/meteor-google-api/blob/master/README.md#tokens
Sounds like we need some better error messages but this should hopefully get you through.
If you removed the autopublish
package, you will need to publish your accessToken
in order for this library to fetch your token.
Meteor.publish(null, function() {
return Meteor.users.find(this.userId, { fields: {
'services.google.accessToken': 1,
'services.google.expiresAt': 1
}});
});
With autopublish
enabled, accounts-google
automatically adds the accessToken and expiresAt fields to the list of fields to be autopublished. Refer to the source code here https://github.com/meteor/meteor/blob/devel/packages/accounts-google/google.js#L15 and here https://github.com/meteor/meteor/blob/d8944f1b4d5a393a1292359d9a6ff09f147e53a4/packages/accounts-base/accounts_server.js#L24 for reference.
I left out refreshToken but you can add it if you want to (careful on the client)
Thanks! I managed to make it work with that. I know have the issue that many requests are executed at the same time to Google, which fails because there is a rate limit. Is there something included in the library to limit the number of calls/second? Or can you recommend something? Thanks.
Hmm, not at this stage now. I think a generic rate limiting library would make sense, no need to work it into this one I wouldn't have thought.
It appears the above example should be in the form of:
GoogleApi.get('/analytics/v3', options, function(error, answer) { console.log(answer); });
Hello,
Really nice module, I am trying to use it but I don't know what to put in options. I have a logged Google user on my app this part is working. I am trying:
In the console I get: message: "Auth token not found.Connect your google account [403]"
Any help would be appreciated. Thanks!